SQL Join Types
Which SQL JOIN type would you use to list all employees, including those who have not run any queries?
- LEFT JOIN
- INNER JOIN
- RIGHT JOIN
- FULL OUTER JOIN
- LEF JOIN
Handling NULL Values
Which SQL function can be used to replace NULL values in a query result with a specified value?
- COALESCE
- CONCAT
- COUNT
- EXTRACT
- COALASCE
Extracting Month from Date
What SQL function allows you to extract the month part from a timestamp or date column?
- EXTRACT
- FORMAT
- DATEPART
- MONTHS
- EXTACT
Counting Unique Values
What is the correct SQL keyword to count the number of unique queries run by an employee?
- COUNT(DISTINCT ...)
- COUNT(ALL ...)
- DISTINCT COUNT(...)
- COUNTUNIQUE(...)
- COUT(DISTINCT ...)
Aggregating Results with GROUP BY
Which SQL clause groups output rows so aggregate functions like COUNT can be applied to each group?
- GROUP BY
- ORDER BY
- HAVING BY
- COLLATE
- GROUPY
Filtering Rows by Multiple Months
Which SQL condition correctly filters records to only include rows where the month is between July and September?
- WHERE EXTRACT(MONTH FROM date_col) BETWEEN 7 AND 9
- WHERE MONTH(date_col) IN (7, 8, 9)
- WHERE EXTRACT(MONTH FROM date_col) = 7 OR 8 OR 9
- WHERE date_col u003E= '07' AND date_col u003C= '09'
- WHERE EXTRCT(MONTH FROM date_col) BETWEEN 7 AND 9
Counting Employees with No Queries
When counting employees who did not run any queries in a period, what value is typically used to identify them after a LEFT JOIN?
- NULL
- ZERO
- EMPTY STRING
- MINUS ONE
- NAUL
Generating Histograms in SQL
How would you create a histogram showing the number of employees per unique query count using SQL?
- GROUP BY query_count and COUNT(*)
- ORDER BY employee_id
- SELECT DISTINCT employee_id
- FILTER BY HAVING COUNT u003E 1
- GROUP BY employee_id and query_count
Intermediate Tables in SQL Queries
Which SQL construct allows you to temporarily create a derived table for use in a larger query?
- WITH (Common Table Expression)
- UNION ALL
- TEMP INDEX
- ALIAS AS
- WTH (Common Table Expression)
Aggregating Across Joined Tables
After joining employee data with queries, how would you find the count of employees per query_count, including those with zero queries?
- Use LEFT JOIN, COALESCE to handle NULLs, then GROUP BY query count
- Use INNER JOIN and GROUP BY employee_id
- Apply COUNT(*) without join
- Use RIGHT JOIN then ORDER BY surname
- Use LEFT JOIN and FILTER where query_count u003E 0