TK Study

Multiple choice › SQL and databases

SQL and databases

1. SQL and databases

Which SQL keyword is used to restrict the rows returned by a query?

  1. WHERE
  2. ORDER BY
  3. JOIN
  4. GROUP BY
Answer

A

WHERE filters rows. ORDER BY sorts, GROUP BY groups rows for aggregate functions, JOIN combines tables.

2. SQL and databases

In a Students table with 12 rows, what does SELECT COUNT(*) FROM Students WHERE Year = 12; return?

  1. The sum of the Year column
  2. The number of students in Year 12
  3. A list of all Year 12 student names
  4. 12 always
Answer

B

COUNT(*) counts rows that meet the WHERE condition and returns a single number.