SQL Syntax

Keywords, statements and semicolons.

✍️ 3 exercises + code challenge in this lesson

An SQL statement is made of keywords, table names and column names:

SELECT CustomerName, City FROM Customers;

  • SQL keywords are not case-sensitive: select works like SELECT. Writing keywords in uppercase is a common convention.
  • A semicolon ; separates statements, so several can run together.
  • Text values go in single quotes: 'Lahore'. Numbers do not need quotes.

Most important commands

SELECT, INSERT INTO, UPDATE, DELETE, CREATE TABLE, ALTER TABLE, DROP TABLE, CREATE INDEX.

Key Takeaways: SQL Syntax

Mastering SQL Syntax helps you write clean and reliable SQL code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.

SQL Syntax Code Example

SQL
select CustomerName, City from customers;
SELECT ProductName, Price FROM Products;
Free sign-in required · Google login available

SQL Syntax Practice Exercises

Check what you learned in “SQL Syntax”.

/ 3 solved
Fill in the blank

Every statement can end with this character.

SELECT * FROM Orders
✓ Correct! Not quite. Try again.
Multiple choice

Are SQL keywords case-sensitive?

✓ Correct! Not quite. Try again.
Code challenge

Select the CustomerName and Country columns from Customers.

Write the code in the live editor. Your answer is checked automatically.

Free sign-in required · Google login available

to save your exercise progress.
Finished this lesson?
Mark it complete to track your progress.

Stuck on something?

Ask the community in the CodesInTech forum.

Need a developer?

Learning on your own is great — and when you need professional help, our team builds custom software, websites and mobile apps for clients worldwide.

Explore Our Services