Database Management & SQL Flashcards
7 cards from real TOC practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Database Management & SQL flashcards as text
Which SQL command permanently removes rows from a table based on a condition?
Answer: DELETE
DELETE removes specific rows matching a WHERE condition and can be rolled back within a transaction, unlike TRUNCATE.
What is the difference between DELETE and TRUNCATE in SQL?
Answer: TRUNCATE is faster and cannot be rolled back in most databases; DELETE can be
TRUNCATE removes all rows quickly by deallocating pages and is typically non-transactional, while DELETE logs each row removal and supports rollback.
In SQL transactions, what does the ROLLBACK statement do?
Answer: Reverses all changes made since the last COMMIT or savepoint
ROLLBACK undoes all data modifications made within the current transaction, restoring the database to its prior committed state.
Which SQL command modifies existing data in a table?
Answer: UPDATE
UPDATE changes existing column values in one or more rows based on an optional WHERE condition.
A stored procedure differs from a regular SQL query primarily because it:
Answer: Is compiled and stored in the database for reuse
A stored procedure is a precompiled set of SQL statements saved in the database, reducing parsing overhead and enabling reuse with parameters.
Which ACID property guarantees that a committed transaction remains saved even after a system crash?
Answer: Durability
Durability ensures that once a transaction is committed, its changes persist permanently even if the system subsequently fails.
What SQL clause restricts the number of rows returned by a query in most relational databases?
Answer: TOP / LIMIT
LIMIT (MySQL/PostgreSQL) or TOP (SQL Server) restricts the result set to a specified maximum number of rows.