SQL AND & OR Operators: Main Tips
- The AND & OR operators filters records based on two or more conditions.
- AND operator is satisfied if only all the conditions separated by AND are TRUE.
- OR operator is satisfied if at least one of the conditions separated by OR are TRUE.
SQL AND Operator: Syntax
Shows a result if all the conditions with AND is TRUE.
SELECT column_demo1, column_demo2, ... FROM table_demo WHERE condition_demo1 AND condition_demo2 AND condition_demo3 ...;
- Simplistic design (no unnecessary information)
- High-quality courses (even the free ones)
- Variety of features
- Nanodegree programs
- Suitable for enterprises
- Paid certificates of completion
- Professional service
- Flexible timetables
- A variety of features to choose from
- Professional certificates of completion
- University-level courses
- Multiple Online degree programs
- Great user experience
- Offers quality content
- Very transparent with their pricing
- Free certificates of completion
- Focused on data science skills
- Flexible learning timetable
SQL OR Operator: Syntax
Shows a result if any of the conditions with OR is TRUE
SELECT column_demo1, column_demo2, ... FROM table_demo WHERE condition_demo1 OR condition_demo2 OR condition_demo3 ...;
This is demo example from the "Developers" table in the database:
|1||Tom Kurkutis||New York||USA|
SQL AND & OR: Examples
In this example, we select all developers from the country "India" AND the city "Delhi", in the "Developers" table:
SELECT * FROM Developers WHERE Country='India' AND City='Delhi';
In this example, we select all developers from the city "London" OR "Paris", in the "Developers" table:
SELECT * FROM Developers WHERE City='London' OR City='Paris';
In this example, we select all developers from the country "USA" AND the city must be equal to "New York" OR "Berlin", in the "Developers" table:
SELECT * FROM Developers WHERE Country='USA' AND (City='New York' OR City='Miami');
Latest Udacity Coupon Found:
75% OFF COURSES
Udacity Black Friday Offer
The best time to save on Udacity courses is now - follow this coupon to access a 75% Udacity Black Friday discount & enjoy learning at a very low cost!