Tsallaka zuwa abun ciki
Justice Tech School

SQL Syntax

An SQL statement ends with a semicolon. Keywords such as SELECT and FROM are not case sensitive, but writing them in capitals makes queries easier to read. Whitespace and line breaks do not matter, so put each clause on its own line.

Table and column names are usually written in lowercase with underscores. Text values go in single quotes.

Example
SELECT name, country
FROM students
WHERE id = 1;

Result

name | country
Ada  | Nigeria
  • Some tools (MySQL, SQL Server) accept a few differences. When a feature varies between databases, a tip tells you.

Exercise

End the statement correctly.

SELECT * FROM students

Quiz Test

Which quotes surround a text value in SQL?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.