SQL Mastery Quiz: Test Your Intermediate Skills Quiz

  1. SQL Join Types

    Which SQL JOIN type would you use to list all employees, including those who have not run any queries?

    1. LEFT JOIN
    2. INNER JOIN
    3. RIGHT JOIN
    4. FULL OUTER JOIN
    5. LEF JOIN
  2. Handling NULL Values

    Which SQL function can be used to replace NULL values in a query result with a specified value?

    1. COALESCE
    2. CONCAT
    3. COUNT
    4. EXTRACT
    5. COALASCE
  3. Extracting Month from Date

    What SQL function allows you to extract the month part from a timestamp or date column?

    1. EXTRACT
    2. FORMAT
    3. DATEPART
    4. MONTHS
    5. EXTACT
  4. Counting Unique Values

    What is the correct SQL keyword to count the number of unique queries run by an employee?

    1. COUNT(DISTINCT ...)
    2. COUNT(ALL ...)
    3. DISTINCT COUNT(...)
    4. COUNTUNIQUE(...)
    5. COUT(DISTINCT ...)
  5. Aggregating Results with GROUP BY

    Which SQL clause groups output rows so aggregate functions like COUNT can be applied to each group?

    1. GROUP BY
    2. ORDER BY
    3. HAVING BY
    4. COLLATE
    5. GROUPY
  6. Filtering Rows by Multiple Months

    Which SQL condition correctly filters records to only include rows where the month is between July and September?

    1. WHERE EXTRACT(MONTH FROM date_col) BETWEEN 7 AND 9
    2. WHERE MONTH(date_col) IN (7, 8, 9)
    3. WHERE EXTRACT(MONTH FROM date_col) = 7 OR 8 OR 9
    4. WHERE date_col u003E= '07' AND date_col u003C= '09'
    5. WHERE EXTRCT(MONTH FROM date_col) BETWEEN 7 AND 9
  7. 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?

    1. NULL
    2. ZERO
    3. EMPTY STRING
    4. MINUS ONE
    5. NAUL
  8. Generating Histograms in SQL

    How would you create a histogram showing the number of employees per unique query count using SQL?

    1. GROUP BY query_count and COUNT(*)
    2. ORDER BY employee_id
    3. SELECT DISTINCT employee_id
    4. FILTER BY HAVING COUNT u003E 1
    5. GROUP BY employee_id and query_count
  9. Intermediate Tables in SQL Queries

    Which SQL construct allows you to temporarily create a derived table for use in a larger query?

    1. WITH (Common Table Expression)
    2. UNION ALL
    3. TEMP INDEX
    4. ALIAS AS
    5. WTH (Common Table Expression)
  10. 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?

    1. Use LEFT JOIN, COALESCE to handle NULLs, then GROUP BY query count
    2. Use INNER JOIN and GROUP BY employee_id
    3. Apply COUNT(*) without join
    4. Use RIGHT JOIN then ORDER BY surname
    5. Use LEFT JOIN and FILTER where query_count u003E 0