Play this advanced programming quiz online for free — 20 hard questions and answers on databases and SQL.
1. What is a 'transaction' in database terms?
💡 A database transaction is a sequence of operations treated as a single, indivisible unit of work.
2. What does 'JOIN' do in SQL?
💡 A JOIN combines rows from two or more tables based on a related column between them.
3. What does 'NoSQL' typically refer to?
💡 NoSQL refers to non-relational databases that use flexible data models beyond traditional tables, such as documents or key-value stores.
4. What is a 'LEFT JOIN'?
💡 A LEFT JOIN returns all rows from the left table, along with matched rows from the right table, filling unmatched columns with NULL.
5. What is a 'view' in SQL?
💡 A view is a virtual table whose contents are defined by a stored SQL query, without duplicating the underlying data.
6. What does 'UNIQUE' constraint ensure in a database column?
💡 A UNIQUE constraint ensures that all values in a column are distinct from one another.
7. What is 'denormalization'?
💡 Denormalization intentionally introduces some redundancy into a database to improve read performance.
8. What does 'COMMIT' do in a SQL transaction?
💡 COMMIT permanently saves all changes made during the current transaction.
9. What does 'ROLLBACK' do in a SQL transaction?
💡 ROLLBACK undoes any changes made during the current transaction, reverting the database to its previous state.
10. What is 'normalization' in database design?
💡 Normalization organizes database tables to minimize redundancy and improve data integrity.
11. What is an 'index' in a database used for?
💡 A database index speeds up data retrieval by providing a faster lookup path for query operations.
12. What is a 'primary key' used for in a relational database?
💡 A primary key uniquely identifies each record in a database table.
13. What is a 'stored procedure'?
💡 A stored procedure is a precompiled set of SQL statements saved in the database that can be executed as a unit.
14. What does 'CASCADE' typically do when used with foreign key constraints on delete?
💡 The CASCADE option automatically propagates deletions or updates to related rows in referencing tables.
15. What does the SQL 'WHERE' clause do?
💡 The WHERE clause filters records in a query, returning only those that meet a specified condition.
16. What does 'INNER JOIN' return?
💡 An INNER JOIN returns only the rows where there is a match in both joined tables.
17. What is 'sharding' in database architecture?
💡 Sharding splits a large database into smaller pieces, or shards, distributed across multiple servers for scalability.
18. What does 'ACID' stand for in database transactions?
💡 ACID stands for Atomicity, Consistency, Isolation, and Durability, key properties of reliable database transactions.
19. What does 'GROUP BY' do in SQL?
💡 GROUP BY groups rows that share a common value, allowing aggregate functions like SUM or COUNT to be applied to each group.
20. What does 'referential integrity' ensure?
💡 Referential integrity ensures that relationships between tables, such as foreign keys, remain valid and consistent.