Test your understanding of the most important SQL concepts, functions, and best practices relevant to data analyst interviews in 2024. This quiz covers key fundamentals, practical scenarios, and optimization techniques.
SELECT Statement Fundamentals
Which SQL keyword is used to retrieve specific columns from a table, for example: SELECT name, age FROM employees?
- GET
- RETURN
- SELECT
- SELCT
- EXTRACT
Understanding INNER JOIN
When using an INNER JOIN between two tables, which rows are included in the result set?
- Rows with NULL values only
- Rows from the left table only
- Only rows that have matching values in both tables
- All rows from both tables
- Rows from the right table only
Aggregating Data with GROUP BY
Which SQL clause would correctly group employee records by department to count the number of employees in each department?
- COLLECT BY
- BUNDLED BY
- CLASSIFY BY
- GROOP BY
- GROUP BY
NULL Value Handling
If you want to replace NULL values in the salary column with 0, which SQL function should you use?
- CASE
- COALASCE
- ISNULL
- COALESCE
- REPLACE
Window Functions
To assign a unique, sequential integer to each row in a result set starting at 1, which SQL window function should be used?
- ROW_NUMBER()
- SERIAL()
- ROW_NUMBER
- RANKS()
- ROW_COUNT()
Date and Time Manipulation
Which SQL function correctly returns the current date and time in a query?
- NOOW()
- DATENOW()
- DATE_TIME()
- NOW()
- CUR_DATE()
Detecting Duplicates
What SQL keyword should you use in the SELECT clause to retrieve only unique values from a column named 'city'?
- UNIQUE
- EXCEPT
- DISTINCT
- DIFFERENT
- DISTNCT
Understanding Indexes
How does creating an index on a column generally affect query performance on large tables?
- It sorts data by default
- It reduces disk space by compressing data
- It deletes duplicate rows automatically
- It optimizes searches by speeding up data retrieval
- It always makes queries run slower
Subqueries in SQL
What is a subquery in SQL?
- A subqueery is a temporary column
- A type of table definition
- A summary of results using aggregates
- A table join with more than two tables
- A query written inside another query
Normalization in Databases
What is the main purpose of normalizing a database?
- To split every column into different tables
- To make tables look smaller
- To minimize data redundancy and improve integrity
- To introduce more NULL values
- To create duplicate copies of every record