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?
- WHERE
- ORDER BY
- JOIN
- 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?
- The sum of the Year column
- The number of students in Year 12
- A list of all Year 12 student names
- 12 always
Answer
B
COUNT(*) counts rows that meet the WHERE condition and returns a single number.