Selection with Conditions
This Tutorial's Database: swim.db
swim.db
Table Name: butterfly200; Showing only first 3 athletes
name | country | time |
---|---|---|
Lindsey Mcneil | Norway | 133831 |
Giada Middleton | Georgia | 144370 |
Natalie Patrick | North Macedonia | 147728 |
There are 30 athletes included athletes with the following characteristics:
randomly generated name
randomly chosen country
randomly generated time measured in milliseconds
2 minutes is 120,000 milliseconds which is very close to Canada's Sarah McIntosh's Olympic Record time in 2024.
Selecting based on specific criteria
The code snippet above is a template of how to choose records that include certain columns which fit the custom condition based criteria
Some Examples of Conditions
SQL Operator | What does it do? | SQL |
---|---|---|
| standard numeric comparisons |
|
| checking for inclusive range |
|
| check for numbers outside of an inclusive range |
|
| value exists in a list |
|
| value does not exist in a list |
|
This query generates:
Finding Spanish, French or Belgian Athletes
Query:
Output
Exercises
Did any randomized athlete beat Sarah McIntosh's Olympic Record of 2 minutes and 3 seconds (123300 milliseconds)?
Are there any Canadian athletes, are there American (United States) athletes, are there any from your background/home country?
Who was the fastest athlete?
Last updated