Answers at bottom of Quiz.
1. What does SQL stand for? A. Structured Language
B. Standardized Query Language
C. Sequential Query Language
D. Systematic Question Language
2. Which keyword is used to retrieve all columns in a SELECT statement? A. SELECT *
B. SELECT COLUMN
C. SELECT ALL
D. SELECT FIELDS
3. What is the primary purpose of the WHERE clause in a SQL query? A. To filter results based on conditions
B. To order results alphabetically
C. To select specific columns
D. To group results by a certain attribute
4. Which data type is used to store whole numbers in MySQL? A. INT
B. FLOAT
C. VARCHAR
D. BOOLEAN
5. What is the purpose of the ORDER BY clause in SQL? A. To filter results
B. To sort results
C. To join tables
D. To limit the number of results
6. In MySQL, what does the term "foreign key" refer to? A. A key that is unique across all tables
B. A key used for encryption
C. A column that points to the primary key in another table
D. A key used for sorting data
7. Which SQL statement is used to update data in a table? A. MODIFY
B. UPDATE
C. ALTER
D. CHANGE
8. What is the purpose of the GROUP BY clause in a SQL query? A. To filter results
B. To group results based on a column
C. To order results
D. To join tables
9. Which function is used to find the total number of rows in a table? A. COUNT()
B. SUM()
C. AVG()
D. TOTAL()
10. What is a stored procedure in MySQL? A. A temporary table
B. A group of SQL statements that can be executed together
C. A way to create virtual columns
D. A method for indexing tables
11. What is normalization in the context of databases? A. The process of simplifying complex queries
B. The process of organizing data to minimize redundancy
C. The process of encrypting data for security
D. The process of optimizing database performance
12. How is a JOIN different from a subquery? A. A JOIN is used for combining rows from different tables, while a subquery is used to return a single value.
B. A subquery is used for combining rows from different tables, while a JOIN is used to return a single value.
C. A JOIN and a subquery are the same thing.
D. A JOIN is only used with numeric data, while a subquery works with any data type.
13. What is the purpose of the HAVING clause in a SQL query? A. To filter results based on conditions
B. To order results alphabetically
C. To filter results after a GROUP BY clause
D. To select specific columns
14. How can you optimize a slow SQL query? A. Add more indexes
B. Remove the WHERE clause
C. Use the DISTINCT keyword
D. Increase the number of columns in the SELECT statement
15. What is a transaction in MySQL? A. A single SQL statement
B. A group of SQL statements that are executed together
C. A sequence of database operations that are executed as a single unit
D. A type of table used for logging changes to the database
16. What is the purpose of the LIMIT clause in a SQL query? A. To filter results based on conditions
B. To limit the number of rows returned
C. To group results based on a column
D. To order results alphabetically
17. How can you add a new column to an existing table in MySQL? A. ALTER TABLE ADD COLUMN
B. INSERT INTO
C. MODIFY TABLE
D. CREATE COLUMN
18. What is the difference between INNER JOIN and LEFT JOIN in MySQL? A. INNER JOIN only returns matching rows, while LEFT JOIN returns all rows from the left table and matching rows from the right table.
B. INNER JOIN returns all rows from both tables, while LEFT JOIN only returns matching rows.
C. INNER JOIN and LEFT JOIN are interchangeable terms.
D. INNER JOIN and LEFT JOIN have no functional difference.
19. What is the purpose of the INDEX keyword in MySQL? A. To create a new table
B. To define a primary key
C. To improve query performance by creating an index on a column
D. To count the number of rows in a table
20. How can you retrieve unique values from a column in MySQL? A. SELECT UNIQUE(column_name)
B. SELECT DISTINCT column_name
C. SELECT UNIQUE VALUES(column_name)
D. SELECT DISTINCT VALUES(column_name)
21. What is a trigger in MySQL, and how is it used? A. A trigger is an event that fires automatically in response to certain actions on the database, such as INSERT, UPDATE, or DELETE operations.
B. A trigger is a special type of stored procedure used for complex calculations.
C. A trigger is a method for encrypting sensitive data in the database.
D. A trigger is a way to schedule automated backups.
22. How does the concept of ACID properties relate to database transactions? A. ACID properties ensure that transactions are processed in alphabetical order.
B. ACID properties ensure the consistency, isolation, and durability of database transactions.
C. ACID properties are only relevant to non-relational databases.
D. ACID properties are used to encrypt data in a database.
23. Explain the difference between a view and a table in MySQL. A. A view is a virtual table based on the result of a SELECT query, while a table is a physical storage structure.
B. A table is a virtual structure used for complex queries, while a view is a physical storage structure.
C. . A table and a view are the same thing.
D. A view is used to store data permanently, while a table is temporary.
24. What is the purpose of the EXPLAIN statement in MySQL? A. To display information about the database schema
B. To provide details about the execution plan of a query
C. To retrieve data from multiple tables
D. To create a graphical representation of the database structure
25. How can you ensure data integrity in a MySQL database? A. By regularly updating all records
B. By using the CHECK constraint
C. By avoiding the use of primary keys
D. By allowing NULL values in columns
26. What is the purpose of the UNION operator in SQL? A. To combine rows from two or more tables without duplicates
B. To update data in a table
C. To order the results of a query
D. To group rows based on a specific condition
27. Explain the concept of database normalization and its benefits. A. Database normalization is the process of organizing data to minimize redundancy and dependency. Benefits include improved data integrity and reduced data duplication.
B. Database normalization is a method for optimizing query performance by creating indexes. Benefits include faster data retrieval.
C. Database normalization is the process of encrypting sensitive data. Benefits include enhanced security.
D. Database normalization is a way to create backups of the database. Benefits include data recovery in case of a failure.
28. What is the purpose of the TRUNCATE statement in MySQL? A. To remove specific rows from a table based on a condition
B. To delete all rows from a table without logging individual row deletions
C. To alter the structure of a table
D. To update data in a table
29. How does the concept of indexing contribute to database performance? A. Indexing is used to define a primary key for a table.
B. Indexing has no impact on database performance.
C. Indexing speeds up the retrieval of rows by creating a data structure that allows for quicker data access.
D. Indexing is used to encrypt sensitive data in the database.
30. What is a stored function in MySQL, and how is it different from a stored procedure? A. A stored function is a set of SQL statements that can be executed together. It is the same as a stored procedure.
B. A stored function is a way to create virtual columns in a table. It is different from a stored procedure, which performs a series of actions.
C. A stored function is a group of SQL statements that return a single value. It is different from a stored procedure, which can return multiple values.
D. A stored function is a temporary table used for complex queries. It is the same as a stored procedure.
Answers:
1B; 2A; 3A; 4A; 5B; 6C; 7B; 8B; 9A; 10B; 11B; 12A; 13C; 14A; 15C; 16B; 17A; 18A; 19C; 20B; 21A; 22B; 23A; 24B; 25B; 26A; 27A; 28B; 29C; 30C;
Thank you