Data Manipulation Language (DML) Flashcards
7 cards from real SQL practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Data Manipulation Language (DML) flashcards as text
Which DML keyword is used in some databases to insert or replace a row by primary key?
Answer: REPLACE
REPLACE (in MySQL) inserts a row or replaces an existing one with the same key.
What does SAVEPOINT allow within a transaction?
Answer: Rolling back to a specific point without undoing everything
SAVEPOINT marks a point you can roll back to without aborting the entire transaction.
In INSERT ... ON CONFLICT DO UPDATE (PostgreSQL), what happens on a key conflict?
Answer: The existing row is updated instead of inserted
ON CONFLICT DO UPDATE turns a conflicting insert into an update of that row.
Which DML operation is most appropriate to correct a typo in one customer's name?
Answer: UPDATE with a WHERE on that customer
A targeted UPDATE with a WHERE clause changes just that one row.
What does the SET col = NULL do in an UPDATE?
Answer: Sets the column to NULL for matched rows
It assigns NULL to the column in the rows matched by WHERE.
Why might a DELETE fail due to a foreign key?
Answer: Child rows still reference the row being deleted
A DELETE can fail if other rows reference it and ON DELETE behavior is restrictive.
What does ON DELETE CASCADE do?
Answer: Automatically deletes related child rows
ON DELETE CASCADE removes child rows automatically when the parent is deleted.