SQL Joins u0026 Aggregations Quiz

Test your foundational knowledge of SQL joins and aggregation functions with this beginner-friendly quiz. Strengthen your SQL skills by reviewing essential concepts such as inner and outer joins, GROUP BY, and aggregate functions including COUNT, SUM, and AVG.

  1. Basic Inner Join

    Which SQL clause is used to combine rows from two tables based on a related column, as shown in the query: SELECT * FROM orders INNER JOIN customers ON orders.customer_id = customers.id?

    1. WHERE
    2. GROUP BY
    3. JOIN
    4. UNION
  2. LEFT JOIN Functionality

    What does a LEFT JOIN return when used between two tables named 'students' and 'grades'?

    1. All rows from both tables
    2. All rows from 'grades' and matching rows from 'students'
    3. Only matching rows from both tables
    4. All rows from 'students' and matching rows from 'grades'
  3. Aggregating Values

    Which SQL function would you use to find the total number of rows in a table named 'products'?

    1. MIN
    2. AVG
    3. COUNT
    4. SUM
  4. GROUP BY Purpose

    What is the purpose of the GROUP BY clause in a SQL SELECT statement?

    1. To filter rows by condition
    2. To group rows that have the same values in specified columns
    3. To order the rows by column values
    4. To update grouped data
  5. Identifying Full Outer Join

    Which join includes all records from both tables, filling with NULLs where there are no matches?

    1. CROSS JOIN
    2. RIGHT JOIN
    3. INNER JOIN
    4. FULL OUTER JOIN
  6. Selecting Maximum Value

    To find the largest value in the 'salary' column of an 'employees' table, which aggregate function would you use?

    1. TOTAL
    2. FIRST
    3. GREATEST
    4. MAX
  7. Handling Duplicates in COUNT

    Which SQL query counts only the distinct values in a 'country' column?

    1. SELECT DISTINCT COUNT(country) FROM table_name;
    2. SELECT COUNT(DISTINCT country) FROM table_name;
    3. SELECT SUM(country) FROM table_name;
    4. SELECT COUNT(UNIQUE country) FROM table_name;
  8. Understanding RIGHT JOIN

    In an SQL query, what does a RIGHT JOIN between 'orders' and 'shippers' return?

    1. All rows from 'shippers' and matching rows from 'orders'
    2. Only rows existing in both tables
    3. All rows from 'orders' and matching rows from 'shippers'
    4. Rows that do not match between the tables only
  9. Averaging Column Values

    Which SQL aggregate function calculates the average of all entries in a numeric column such as 'score'?

    1. MOD
    2. AVG
    3. COUNT
    4. SUM
  10. Purpose of HAVING Clause

    Which SQL clause is used to filter groups created by GROUP BY, such as showing only departments with more than 5 employees?

    1. ORDER BY
    2. SKIP
    3. HAVING
    4. WHERE