Question
SQL Worksheet 1. Answer the questions below. If a schema is not given, you may assume a table structure that makes sense in the context
SQL Worksheet 1. Answer the questions below. If a schema is not given, you may assume a table structure that makes sense in the context of the question.
| Given the following tables:
sql> SELECT * FROM runners; +----+--------------+ | id | name | +----+--------------+ | 1 | John Doe | | 2 | Jane Doe | | 3 | Alice Jones | | 4 | Bobby Louis | | 5 | Lisa Romero | +----+--------------+
sql> SELECT * FROM races; +----+----------------+-----------+ | id | event | winner_id | +----+----------------+-----------+ | 1 | 100 meter dash | 2 | | 2 | 500 meter dash | 3 | | 3 | cross-country | 2 | | 4 | triathalon | NULL | +----+----------------+-----------+ What will be the result of the query below?
SELECT * FROM runners WHERE id NOT IN (SELECT winner_id FROM races) Explain your answer and provide an alternative version that will avoid the issue that it exposes.
|
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started