SQLancer
LESSON 1

SQL (Core) - SELECT queries 101

Progress: 0%

SELECT queries 101

To retrieve data from a SQL database, we construct SELECT statements (queries). A query is a declarative statement specifying what data we want, where it resides, and how to filter or transform it.

The Mechanics of Column Projection

Rather than grabbing every column with SELECT *, production systems explicitly request specific attributes by separating column names with commas:

SELECT title, director FROM movies;

Why Explicit Projection Matters

Selecting only the required columns reduces network bandwidth overhead, decreases application memory usage, and allows relational database query planners to utilize fast index-only scans without reading full table rows from disk storage.

💡

SQL Syntax Conventions

SQL keywords (SELECT, FROM) are case-insensitive, but writing keywords in UPPERCASE by convention dramatically improves readability when scanning complex multi-line queries.

🎬 Table: Movies

id title director year length_minutes
1 Toy Story John Lasseter 1995 81

🗄️ Schema Explorer SELECTABLE

movies
|

🎯 Exercises Checklist:

1. Find the title of each film
2. Find the director of each film
3. Find the title and director of each film
4. Find the title and year of each film
5. Find all information about each film
⚡ Practice Console

Data Output

No results. Run query to fetch data.

Current Task Target

5 rows