SQLite Interview Questions and Answers
Ques 16. What is the purpose of the COMMIT and ROLLBACK statements in SQLite?
The COMMIT statement is used to permanently save changes made during the current transaction, while ROLLBACK is used to undo the changes.
Ques 17. Explain the difference between PRIMARY KEY and UNIQUE constraints in SQLite.
A PRIMARY KEY constraint uniquely identifies each record in a table, and there can only be one PRIMARY KEY in a table. The UNIQUE constraint, on the other hand, ensures that all values in a column are unique.
Ques 18. How to delete a table in SQLite?
You can delete a table in SQLite using the DROP TABLE statement: `DROP TABLE table_name;`.
Ques 19. What is the purpose of the FOREIGN KEY constraint in SQLite?
The FOREIGN KEY constraint is used to link two tables together by referencing the primary key of one table as a foreign key in another, enforcing referential integrity.
Ques 20. Explain the concept of a transaction in SQLite.
A transaction in SQLite is a series of one or more SQL statements that are executed as a single unit. Transactions ensure the atomicity, consistency, isolation, and durability of database operations.
Most helpful rated by users: