SQLite – 5 – Primary Keys and Constraints MCQ

SQLite – Primary Keys and Constraints

1 / 26

1. What is the primary purpose of a primary key in a database table?

2 / 26

2. Which keyword is used to specify a primary key constraint when creating a table?

3 / 26

3. In SQLite, can a table have more than one primary key?

4 / 26

4. What happens when you try to insert a duplicate value into a column with a primary key constraint?

5 / 26

5. Which SQL command is used to remove a primary key constraint from a column in SQLite?

6 / 26

6. What is the purpose of the “NOT NULL” constraint in SQLite?

7 / 26

7. How do you specify that a column should allow NULL values when creating a table in SQLite?

8 / 26

8. Which keyword is used to specify that a column should have a default value when creating a table?

9 / 26

9. What is the purpose of the “CHECK” constraint when creating a table in SQLite?

10 / 26

10. How do you specify a default value for a column when creating a table in SQLite?

11 / 26

11. What is the purpose of the “UNIQUE” constraint on a column when creating a table in SQLite?

12 / 26

12. In SQLite, how do you specify a column as the primary key when creating a table?

13 / 26

13. What is the purpose of the “AUTOINCREMENT” keyword when creating a table in SQLite?

14 / 26

14. What happens if you try to create a table with a primary key that has a data type of TEXT?

15 / 26

15. Which SQL command is used to create a unique index on a column when creating a table in SQLite?

16 / 26

16. What is the primary purpose of the “FOREIGN KEY” constraint when creating a table in SQLite?

17 / 26

17. Which keyword is used to specify a foreign key constraint on a column when creating a table in SQLite?

18 / 26

18. How do you specify that a column should have a foreign key constraint when creating a table in SQLite?

19 / 26

19. What is the purpose of the “ON DELETE CASCADE” clause in a foreign key constraint?

20 / 26

20. Which SQL command is used to remove a foreign key constraint from a column in SQLite?

21 / 26

21. What is the primary benefit of using primary keys and constraints in a SQLite database?

22 / 26

22. How do you specify that a column should have a check constraint when creating a table in SQLite?

23 / 26

23. Which keyword is used to specify a column as the primary key and auto-incremented when creating a table in SQLite?

24 / 26

24. In SQLite, how do you specify that a column should allow NULL values when creating a table?

25 / 26

25. What is the primary purpose of the “DEFAULT CURRENT_TIMESTAMP” constraint in SQLite?

26 / 26

26. Which keyword is used to specify that a column should have a unique constraint and a default value when creating a table in SQLite?

Your score is

0%