SQL: DDL-DML, queries, views, stored procedures, triggers and SQL injection issues. - Question Bank
1. Which SQL statement is used to undo all the changes made during a transaction?
2. Which SQL statement is used to save all the changes made during a transaction?
3. Which SQL statement is used to create a transaction?
4. What is a Foreign Key in SQL?
5. In SQL, what is a Primary Key?
6. What is a key difference between `DELETE` and `TRUNCATE` in SQL?
7. Which SQL command is used to delete all records from a table without deleting the table structure?
8. What is the purpose of an index in a database?
9. Which SQL statement is used to create an index on a table?
10. What is the difference between `UNION` and `UNION ALL` in SQL?
11. What does `UNION` operator do in SQL?
12. Which SQL statement is used to remove a column from an existing table?
13. Which SQL statement is used to add a new column to an existing table?
14. What is a primary defense against SQL Injection attacks?
15. Which of the following is a common vulnerability that can lead to SQL Injection?
16. What is SQL Injection?
17. What does `AFTER UPDATE` in a trigger definition signify?
18. What does `BEFORE INSERT` in a trigger definition signify?
19. What is a potential benefit of using stored procedures?
20. What is a common characteristic of stored procedures?
21. Which type of `JOIN` returns only the rows where there is a match in both tables?
22. Which type of `JOIN` returns all rows when there is a match in either the left or the right table?
23. Which type of `JOIN` returns all rows from the left table, and the matched rows from the right table, with NULLs for non-matches on the right?
24. What is the purpose of a `JOIN` clause in SQL?
25. Which SQL clause allows you to specify a condition to filter rows *after* grouping has taken place?
26. Which SQL clause allows you to specify a condition to filter rows *before* any grouping takes place?
27. In a SQL query, what does the `AS` keyword typically do?
28. Which of the following are DML statements?
29. What is the primary purpose of Data Manipulation Language (DML) in SQL?
30. Which of the following are DDL statements?
31. What is the primary purpose of Data Definition Language (DDL) in SQL?
32. Which SQL command is used to remove a trigger from the database?
33. Which SQL command is used to remove a stored procedure from the database?
34. Which SQL command is used to remove a view from the database?
35. A trigger is a set of actions that are automatically executed by the database system. When are triggers typically executed?
36. Which SQL statement is used to create a trigger?
37. What is a stored procedure in SQL?
38. Which SQL statement is used to create a stored procedure?
39. A view is a type of SQL query that is stored in the database. What is it often referred to as?
40. Which SQL command is used to create a view?
41. Which SQL clause is used with GROUP BY to filter groups based on a specified condition?
42. Which SQL clause is used to group rows that have the same values into summary rows?
43. Which SQL keyword is used to return only unique values?
44. Which SQL keyword is used to specify conditions for a query?
45. Which SQL statement is used to modify the structure of a table?
46. Which SQL statement is used to delete a table from a database?
47. Which SQL statement is used to create a new table in a database?
48. Which clause is used to sort the result-set in ascending or descending order?
49. Which SQL statement is used to extract data from a database?
50. Which SQL statement is used to delete records from a table?