SQL follows some unique set of rules and guidelines called syntax. The SQL syntax is quite an easy one to learn. Here, in this tutorial, we are providing all the basic SQL syntax.
SQL is not case sensitive which means SELECT
and select have the same meaning in SQL statements.
SQL syntax allows us to write the SQL statement line breaks at logical points without it breaking the statement.
All the SQL statements start with any of the keywords like, SELECT
INSERT
, UPDATE
, DELETE
, ALTER
, DROP
, CREATE
, USE
, SHOW
and all the statements end with a semicolon (;
). There are some exceptions where a semicolon may be omitted.
Here are the various syntax for SQL statements. All the SQL Statement Syntax Follow the tutorials:
SELECT * FROM tableName; //here * represent all the columns
SELECT column1, column2....columnN
FROM tableName;
SELECT DISTINCT column1, column2...columnN
FROM tableName;
SELECT column1, column2....columnN
FROM tableName
WHERE Condition;
SELECT column1, column2....columnN
FROM tableName
WHERE Condition1 AND Condition2;
SELECT column1, column2....columnN
FROM tableName
WHERE Condition1 OR Condition2;
SELECT column1, column2....columnN
FROM tableName
WHERE column_name IN (val1, val2,...val-N);
SELECT column1, column2....columnN
FROM tableName
WHERE columnName BETWEEN val1 AND val2;
These are some SQL Statement syntax given above and for all other SQL statements syntax follow the tutorials.