The OR operator displays a record if ANY conditions listed are true. The AND operator displays a record if ALL of the conditions listed are true
The WHERE clause can be combined with AND and OR operators, to filter the records based on more than one condition the AND and OR operators are used:
AND Syntax
SELECT column1, column2, column3, ...FROM table_name WHERE conditionA AND conditionB AND conditionC ...;
OR Syntax
SELECT column1, column2, column3, ...FROM table_name WHERE conditionA OR conditionB OR conditionC ...;
AND Example
The following SQL statement selects all fields from "SlightBook" where the course is "HTML" AND Duration is "6 Months":
Example
SELECT * FROM SlightBook WHERE course='HTML' AND Duration='6 Months';
OR Example
The following SQL statement selects all fields from "SlightBook" where the course is "HTML" OR "CSS":
Example
SELECT * FROM SlightBook WHERE course='HTML' OR City='CSS';
With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" starts with an "a"?
With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" is "Peter"?
With SQL, how do you select all the columns from a table named "Persons"?
With SQL, how do you select a column named "FirstName" from a table named "Persons"?
Which SQL statement is used to insert new data in a database?