SQL Interview Challenge: 2025 Edition Quiz

Test your expertise with advanced SQL questions commonly faced in interviews at top companies. This quiz gauges your knowledge of complex SQL concepts, syntax, and best practices.

  1. Window Function Usage

    If you want to assign a rank to each employee's salary in descending order within the same result set (without collapsing rows), which SQL window function is best suited for this task?

    1. COLLECT()
    2. RINK() OVER (ORDER BY salary DESC)
    3. ROWCOUNT()
    4. MAX(salary)
    5. RANK() OVER (ORDER BY salary DESC)
  2. Understanding Data Integrity

    Which table constraint ensures that a column contains only unique, non-NULL values and is used to uniquely identify each row in a table?

    1. Primary Key
    2. Premary Key
    3. NOT NULL
    4. Default Key
    5. Foreign Kay
  3. Advanced JOIN Knowledge

    What type of SQL JOIN returns all rows from both tables, with NULLs in places where a match does not exist?

    1. INNER JOIN
    2. LEFT JOIN
    3. FOLL JOIN
    4. FULL JOIN
    5. RITE JOIN
  4. Statement Differences

    If you need to remove all data from a table and also free the storage space used, which SQL statement should you use?

    1. DROP
    2. DR0P
    3. TRUNCATION
    4. CLEAR
    5. DELETE
  5. Filtering Data with Aggregations

    Which clause should you use to filter the results of a GROUP BY aggregation, such as finding departments with average salary above $70,000?

    1. FILTER
    2. HAVING
    3. HEAVING
    4. WHERE
    5. SELECT
  6. Second Highest Value Retrieval

    Which SQL query correctly finds the second highest salary from an 'employees' table?

    1. SELECT MAX(salary) - 1 FROM employees;
    2. SELECT salary FROM employees WHERE RANK()=2;
    3. SELECT MIN(salary) FROM employees;
    4. SELECT TOP 2 salary FROM employees ORDER BY salary DESC;
    5. SELECT MAX(salary) FROM employees WHERE salary u003C (SELECT MAX(salary) FROM employees);
  7. Normalization Insight

    Which form of normalization ensures that every non-prime attribute is fully functionally dependent on the primary key but not on a subset of any composite key?

    1. Third Nomal Form
    2. First Noraml Form
    3. Zero Normal Form
    4. Boycee-Codd Normal Form
    5. Second Normal Form
  8. Distinct Data Extraction

    To select only unique city names from a table named 'addresses', which SQL keyword should you use in your SELECT statement?

    1. UNIQUE
    2. DISCRETE
    3. DISINCT
    4. DISTINCT
    5. DISTINCTIVE
  9. Aggregations Explanation

    In the statement 'SELECT AVG(age) FROM users;', what is the purpose of AVG()?

    1. Calculates the average value over all selected rows
    2. Inserts a new row into the users table
    3. Finds the maximum age
    4. Aggregates only unique ages
    5. Lists all ages in ascending order
  10. Combined Query Operations

    Given two SELECT queries for customer IDs, which operator should you use to combine their results while including all duplicates?

    1. UNIONE ALL
    2. JOINT
    3. UNION
    4. MERGE
    5. UNION ALL