Which of the following best describes the purpose of Data Manipulation Language (DML) operations in a database?
Think about what happens when you add, change, or remove rows in a table.
DML operations are used to insert, update, or delete data inside tables. They change the actual data stored.
Given the table employees with columns id, name, and salary, what will be the result of this query?
UPDATE employees SET salary = salary + 500 WHERE id = 3;
Assuming the employee with id = 3 had a salary of 3000 before, what will be the new salary?
Think about what the UPDATE statement does to the existing value.
The UPDATE adds 500 to the current salary of 3000, resulting in 3500.
Which option contains a syntax error in the DELETE statement?
DELETE FROM employees WHERE;
Check if the WHERE clause is complete and valid.
Option D has an incomplete WHERE clause with no condition, causing a syntax error.
You want to increase the salary by 10% for all employees in the sales department. Which query is the most efficient?
Consider which query updates only the needed rows and calculates the increase correctly.
Option A efficiently updates only sales employees and correctly increases salary by 10%.
Consider this INSERT statement:
INSERT INTO employees (id, name, salary) VALUES (1, 'Alice');
Why does this query fail?
Check if all columns listed have matching values.
The INSERT lists three columns but provides only two values, causing an error due to missing salary value.