In: Computer Science
1.Which of the following is a DML operation on table employee?
change an employee's stree address
cancel the insertion of 3 new employees in table employee
add a column phone2 to table employee to limit the salary amount to be at most $200,000
add a constraint in table employee to limit the salary amount to be at most $200,000
The correct DML operation is "change an employee's street address". DML stands for Data Manipulation Language. The basic operations as part of DML include INSERT, UPDATE, DELETE. All these 3 operations manage the data stored in the table.
The INSERT will add 1 or more records to the table.
The UPDATE will change the already existing data in a column in the table. In this case the employee’s street address is changed which can be achieved using an UPDATE statement.
The DELETE will remove the already existing records from the table.
Since changing the employee address falls into the UPDATE statement that is the correct DML operation on the table Employee.
Explanation on incorrect options.
Cancelling the Insert operation of 3 new employees can be achieved using transaction and rollback statements. This does not fall into the INSERT, UPDATE and DELETE. Also this operation is not managing or altering anything on the table.
Adding a column “phone2” is an example of DDL statements. And that means that the table structure is modified using this statement and not the data that resides in the table. Hence this is not a DML operation.
Adding a constraint in the Employee table is about putting a check to limit the salary amount. It’s not in anyways falls into the category of altering the data inside the table. So this is also not a DML operation.