Last updated

SQL Syntax

Definition: An SQL statement is a command that tells the database to do something. Most begin with a keyword such as SELECT, INSERT, UPDATE, or DELETE, and end with a semicolon ;.

Example 1 — the shape of a query

SELECT column1, column2
FROM table_name;

Keywords are not case-sensitive

SELECT, select, and Select all work. By convention we write keywords in UPPERCASE so they stand out from table and column names.

Example 2 — choose specific columns

SELECT CustomerName, Country
FROM Customers;

Semicolons separate statements

The semicolon marks the end of a statement. It is required when you run several statements together (you will do this when an example shows the result of a change).

💡 Tip: spaces and line breaks are ignored, so spread a query over several lines to keep it readable.

Try it Yourself
Output

          
Ad · responsive