1.INSERT statements
Adding records to a data table
The syntax is as follows:
INSERT into table_name[(Column[,column ...]) VALUES (Value[,value ...]);
After performing the DML operation, the commit statement needs to be executed before the operation is truly confirmed.
If the inserted column has a date field, you need to consider the format of the date
The default date format, converted to date type data with the To_date function
--Inserting records using the default date format
INSERT into Myemp (Id,name,job,birth) VALUES (1002, ' Martha ', ' ANALYST ', ' 01-sep-03 ');
--Insert a record using a custom date format
INSERT into Myemp (Id,name,job,birth) VALUES (1003, ' Donna ', ' MANAGER ', to_date (' 2009-09-01 ', ' yyyy-mm-dd '));
2.UPDATE statements
Update records in a table
The syntax is as follows:
UPDATE table_name SET column = value [, Column=value] ... [WHERE condition];
If there is no WHERE clause, the data for the entire table will be updated, so be careful.
3.DELETE statements
Delete a record in a table
The syntax is as follows:
DELETE [from] table_name [WHERE condition];
If there is no WHERE clause, the data for the entire table will be deleted!
The TRUNCATE statement in the DDL statement also has the effect of deleting the table data.
The difference between the and DELETE statements:
Delete can be conditionally deleted, truncate all table data
Delete is a DML statement that can be rolled back, truncate is a DDL statement that immediately takes effect and cannot be rolled back
If you delete all table records, and the amount of data is large, the DELETE statement is less efficient than the TRUNCATE statement.
--Delete all records
DELETE from Myemp;
-OR
TRUNCATE TABLE myemp;
Data deletion and modification