Chapter 1 · Lesson 1 of 4
Your First Query
Write your first SQL query with SELECT * FROM and return every row and column from a sample employees table directly in your browser.
SQL (Structured Query Language) is the standard language for working with data in databases. The most fundamental SQL statement is SELECT, which retrieves data from a table.
The simplest query looks like this:
SELECT * FROM table_nameThe asterisk (*) means "all columns". This query returns every row and every column from the specified table.
Click "Load Data" below to create a sample employees table, then try running the query yourself!
Sample data
This lesson loads the employees table (8 rows) into DuckDB in your browser with one click, so you can run every example without uploading anything.
Setup SQL for employees
CREATE OR REPLACE TABLE employees (
id INTEGER,
name VARCHAR,
department VARCHAR,
salary DECIMAL(10,2),
hire_date DATE
);
INSERT INTO employees VALUES
(1, 'Alice', 'Engineering', 95000, '2021-03-15'),
(2, 'Bob', 'Marketing', 72000, '2020-07-01'),
(3, 'Charlie', 'Engineering', 110000, '2019-01-10'),
(4, 'Diana', 'Sales', 68000, '2022-11-20'),
(5, 'Eve', 'Marketing', 78000, '2021-09-05'),
(6, 'Frank', 'Engineering', 102000, '2020-02-28'),
(7, 'Grace', 'Sales', 71000, '2023-04-12'),
(8, 'Hank', 'Marketing', 65000, '2022-06-30');Practice challenge
Select all rows and columns from the employees table.
Run your query in the editor and the lesson checks the result automatically.
Lessons in Introduction to SQL
Write your first SELECT queries: return rows, choose columns, rename results with aliases, and sort output with ORDER BY.
Related guides
Introduction to SQL: SELECT, Columns, Aliases, and Sorting Results
Your first SQL queries do not need to be complicated. Start with SELECT, choose the columns you need, name results clearly, and sort rows intentionally.
How to Analyze a CSV File with SQL: A Step-by-Step Walkthrough
From raw CSV export to answer: confirm the detected column types, filter and aggregate with SQL, join a lookup file, and export only the result you need.
SQL Cheat Sheet for Data Analysis: Filter, Group, Join, Dates, and Ranking
One pattern per common analysis question, from previewing a new table to ranking rows inside groups, each linked to a lesson where you can practice it.