How to use SQL Syntax? Explanation with example

SQL Syntax

SQL syntax defines as a unique set of guidelines rules called Syntax. Tutorial Scan gives you a quick start the basic of SQL.

All the SQL statements start with keywords just like as INSERT, SELECT, UPDATE, ALTER, DELETE, CREATE, DROP, USE, SHOW and all the statements end with a semicolon (;).
Sql Syntax image
SQL is case-insensitive, which means select and SELECT have the same meaning in SQL statements. Whereas, MySQL makes difference in table names. So, if you want to work with MySQL, then you need to give table names as they exist in the database.

Statement

SELECT column-names
FROM table-name
WHERE condition
ORDER BY sort-order

Example:

SELECT Name, Sex, City, Country 
FROM Employee
WHERE City = 'Paris'
ORDER BY Name

The SQL INSERT Syntax

INSERT table-name (column-names)
VALUES (column-values)

Example:

INSERT Employee (Name, Sex, City, Country)
VALUES ('John', 'Male', 'Oxford', 'UK')

The SQL UPDATE Syntax

UPDATE table-name
SET column-name = column-value
WHERE condition

Example:

UPDATE OrderItem
SET Quantity = 4
WHERE Id = 121

The SQL DELETE Syntax

DELETE table-name
WHERE condition

Example:

DELETE Employee
WHERE Email = 'info@tutorialscan.com'

 

Resource
SQL