Lesson 1

Your First SQL Query

Write your very first SQL statement and see results instantly.

What is SQL?

SQL (Structured Query Language) is the language used to talk to databases. Every time a business pulls a sales report, looks up a customer, or counts orders — SQL is running behind the scenes.

You don't need to install anything. Just type a query, hit Run, and see results.

Your very first query

The simplest SQL query returns a plain value — no table needed.

sql
SELECT 'Hello World!';

SELECT tells SQL: give me this. The text in quotes is what you're asking for.

Adding a column name

By default, SQL names the column after what you typed. You can give it a cleaner name using AS.

sql
-- Column name without a space
SELECT 'Hello World' AS ColumnTitle;

-- Column name with a space — wrap in double quotes
SELECT 'Hello World' AS "Column Title";
Key idea: AS renames a column in the result. It doesn't change the data — just the label you see.

SQL is case-insensitive

These two queries do exactly the same thing:

sql
SELECT 'Hello';
select 'Hello';

Convention is to write keywords like SELECT, FROM, WHERE in uppercase. It makes queries easier to read.

Semicolons

A semicolon ; marks the end of a query. It's optional when running one query at a time, but good habit to include it.

sql
SELECT 'Hello World!';
Practice
Exercise 1 Easy
Write a query that returns the text "SQL is fun" with the column label "Message".
Hint: Use SELECT with AS to label your output
Solution
SELECT 'SQL is fun' AS Message