Country: Papua New Guinea
You are in the Papua New Guinea edition. Type your country to switch.
Nigeria
Oceania
Loading every country…
No country matches. Check the spelling, or choose "Any country" for the Global edition.
You are learning in the Papua New Guinea edition, with examples in kina and from Papua New Guinea.
Your learning profile
Data skills: SQL and Python basics · Lesson 2 of 7
SQL basics: SELECT, WHERE and ORDER BY
SQL is the language for asking questions of tables. This lesson writes your first queries on a small example sales table: choosing columns with SELECT, filtering rows with WHERE, sorting with ORDER BY and keeping only the first few rows with LIMIT.
This lesson is complete in writing. A video for it is on its way.
What you will learn
- By the end you can write a query that chooses columns with SELECT and rows with WHERE.
- You can combine conditions with AND, OR, IN, BETWEEN and LIKE, using brackets to make the meaning clear.
- You can find missing values with IS NULL and explain why an equals sign does not work.
- You can sort results with ORDER BY and keep the top few rows with LIMIT.
Key terms in this lesson
- SQL
- Structured Query Language: the standard language for asking a relational database to select, filter, combine and summarise rows of data.
- SQL query
- A written request to a database in SQL that asks for data, for example which columns to show, which rows to keep and in what order to sort them.
- WHERE clause
- The part of an SQL query that keeps only the rows meeting a condition, such as a given city or a number of units above a set amount, before anything else happens.
- LIKE pattern
- A text pattern used in SQL to match values that fit a shape, where a percent sign stands for any run of characters, for example every city starting with M.
- NULL value
- The marker a database uses for a missing or unknown value. It is not zero or empty text, and it is found with IS NULL rather than an equals sign.
- Step 1: Your first query, not started
- Step 2: Filtering rows with WHERE, not started
- Step 3: Combining conditions: AND, OR and IN, not started
- Step 4: BETWEEN, LIKE and missing values, not started
- Step 5: Sorting with ORDER BY and taking the top few, not started
- Step 6: Common slips and how to check your answer, not started
About 11 min of reading
Step 1 of 6
Your first query
Opening this step…
Step 2 of 6
Filtering rows with WHERE
This step opens when you finish the one above.
Step 3 of 6
Combining conditions: AND, OR and IN
This step opens when you finish the one above.
Step 4 of 6
BETWEEN, LIKE and missing values
This step opens when you finish the one above.
Step 5 of 6
Sorting with ORDER BY and taking the top few
This step opens when you finish the one above.
Step 6 of 6
Common slips and how to check your answer
This step opens when you finish the one above.
Key takeaways
The key takeaways open when you finish every step.
Lesson quiz
6 questions. You need 85% to pass.
The quiz opens when you finish every step.
Stockertim Learn is education. It explains how investing works and never recommends buying or selling anything.
Popular this week: Basics: BeginnerStock market: Intermediate