โ† All TOC Flashcard Decks

Database Management & SQL Flashcards

7 cards from real TOC practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Database Management & SQL flashcards as text
  1. Which SQL JOIN type returns only rows where there is a match in BOTH tables?

    Answer: INNER JOIN

    INNER JOIN returns only the rows that have matching values in both joined tables.

  2. In SQL, which aggregate function returns the number of non-NULL values in a column?

    Answer: COUNT()

    COUNT(column_name) counts non-NULL values, while COUNT(*) counts all rows including NULLs.

  3. Which clause is used to filter results AFTER a GROUP BY aggregation?

    Answer: HAVING

    HAVING filters grouped results after aggregation, whereas WHERE filters rows before grouping.

  4. A talent database query needs to list all employees and their managers, including employees with no manager. Which JOIN is most appropriate?

    Answer: LEFT JOIN

    LEFT JOIN returns all rows from the left (employees) table even when no matching row exists in the right (managers) table.

  5. What does the SQL keyword DISTINCT do when used in a SELECT statement?

    Answer: Removes duplicate rows from results

    DISTINCT eliminates duplicate rows so each unique combination of selected column values appears only once.

  6. Which SQL statement is used to retrieve data from a database?

    Answer: SELECT

    SELECT is the DML statement used to query and retrieve data from one or more database tables.

  7. In a talent analytics query, you want the average performance score grouped by department, but only for departments with more than 10 employees. Which SQL correctly applies this?

    Answer: SELECT dept, AVG(score) FROM staff GROUP BY dept HAVING COUNT(*)>10

    HAVING COUNT(*)>10 filters aggregated groups after GROUP BY, which WHERE cannot do.