A DML statement can be used as whenever you want to
DML is a very important part of Structure Query Language(SQL). Whenever you want to add, modify, delete data in a database you execute a DML statement. A collection of DML statement is called as a transaction.
The insert statement helps us to insert a record in a table. The syntax of insert statement is :
Implicit method:- removing the column from the column list whose value will be null. For example,
specifying the null keyword or a single space enclosed between two single quotes(‘ ‘) in the values clause. For example:
If you want to put null in a character or date type field in that case specify a single space enclosed by quotes(' ') in the values list.
The update statement can be used to make changes on the existing records of a table. The update statement can update more than one record at a time. The syntax of update statement is:
Column is the name of column in the table which has to be filled with a new value.
Value is a corresponding value for the column.
Condition identifies the row to be updated.
In the above example the dept-id of the employee whose emp-id is 102. The where clause is used in SQL statement whenever you have to do an operation based on a condition.
If you want to make changes on a field of a table which is dependant to some other table then ensure that new value is valid one in the other table. Otherwise integrity constraint error will come.
The delete statement is used to remove a row from a table. The syntax of delete statement is :
If no rows are deleted, a message "0 rows deleted" is returned. For example,