General Concepts Flashcards
7 cards from real SQL practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 General Concepts flashcards as text
Which type of JOIN returns only rows with matching values in both tables?
Answer: INNER JOIN
An INNER JOIN returns only rows where the join condition matches in both tables.
What does a foreign key establish?
Answer: A link between two tables
A foreign key references a primary key in another table, enforcing referential integrity.
Which aggregate function counts the number of rows?
Answer: COUNT()
COUNT() returns the number of rows matching the query.
What does the GROUP BY clause do?
Answer: Groups rows sharing a value for aggregation
GROUP BY groups rows with the same values so aggregate functions can summarize them.
Which clause filters results after aggregation?
Answer: HAVING
HAVING filters groups after aggregation, unlike WHERE which filters rows before.
What is the purpose of an index in a database?
Answer: To speed up data retrieval
An index improves query performance by allowing faster lookups.
Which keyword removes duplicate rows from a result set?
Answer: DISTINCT
DISTINCT eliminates duplicate rows from the query output.