The SQL AND, OR and NOT Operators
The SQL AND, OR and NOT Operators
AND, OR, and NOT operators are combined with the WHERE clause. In order to filter records based o
on more than one condition, the AND, OR operators are used. However AND, OR, NOT operators can be
applied through combining.
AND operator shows record s if all the conditions are separated by AND or TRUE.
AND Syntax:
SELECT column1, column2,...
FROM table_name
WHERE condition1 AND condition2 AND condition3 ...;
The OR operator displays a record if a condition is separated by OR is TRUE.
OR Syntax:
SELECT column1, column2,...
FROM table_name
WHERE condition1 OR condition2 OR condition3 ...;
NOT Syntax:
SELECT column1, column2,...
FROM table_name
WHERE NOT condition;
SELECT column1, column2,...
FROM table_name
ORDER BY column1, column2,... ASC|DESC;
SQL INSERT INTO Statement
To insert a new record in a table the INSERT INTO statement is used.
INSERT INTO Syntax:
There are two ways to write insert into statement.
The first way: