Multi-Table Queries Flashcards

1️⃣ Familiarise yourself with the flashcards:

  • Look through all the flashcards to see what's on both sides.
  • Make sure you understand the information on each card. If something's unclear, click the link to the revision notes at the bottom of the page for more details.

2️⃣ Test yourself:

  • Look at the question or prompt on each card and try to remember the answer before flipping it over.
  • Check the answer and make a note of any cards you find challenging and need to go over more.

3️⃣ Consistently Review and Practice:

  • Use spaced repetition: spend more time on the cards you struggle with and go over them more often.
  • Regularly review all the flashcards to help you better understand and retain the information over time.

Note: We may include questions that have multiple correct answers. It's useful to remember specific examples to understand these concepts better.

PERSONALISED 1-TO-1 TUTORING

Need more help on this topic? Get 1-to-1 support

Get support with clear explanations, practice and feedback (Ages 5 to 16).

  • DBS-checked tutors
  • Flexible times
  • Parents can be updated

Want an ad-free experience? Subscribe to remove ads

What is a multi-table query?

A SQL query that combines data from two or more tables.

Why use a multi-table query?

To get related data kept in different tables in one result.

Which columns do you match to join tables?

The key fields, such as a primary key and its matching foreign key.

What does an INNER JOIN return?

Only rows where the join columns match in both tables.

What does a LEFT JOIN return?

All rows from the left table and the matches from the right; no match shows NULL (no data).

What does the ON part of a JOIN do?

It sets the rule that links rows between the tables.

How do you avoid confusion when two tables share a column name?

Use table.column or an alias, for example customers.id and orders.id.

What is a table alias and why use one?

A short table name in a query. It makes columns quicker to type and read.

How do you filter the results of a multi-table query?

Add a WHERE clause to keep only the rows that meet a condition.

How can you join three tables in one query?

Use two JOINs: link table A to B, then B to C.

How do you pick columns from both tables in the SELECT list?

List each column after SELECT, using table names or aliases to show which table.

How do you sort rows from a multi-table query?

Use ORDER BY, naming the column to sort on.