Training Query1 Select Operators
Training Query1 Select Operators
(2) select all columns from the customers table with last_name 'Doe' (= Operator)
(3) select all columns from Customers table with age greater than 25 (> operator)
(4) select all columns from Customers table with last_name 'Doe' and country 'USA' (and operator)
SELECT first_name, last_name FROM Customers WHERE country = 'USA' AND last_name = 'Doe';
(6) select customers who don't live in the USA (Not Operator)
(7) select customers who live in either USA or UK and whose age is less than 26 (combination of
operators)
SELECT * FROM Customers WHERE (country = 'USA' OR country = 'UK') AND age < 26;
(8) exclude customers who are from the USA and have 'Doe' as their last name (use of NOT operator)
SELECT * FROM customers WHERE NOT country = 'USA' AND NOT last_name = 'Doe';
SELECT first_name, country FROM Customers WHERE country NOT IN ('UK', 'UAE');
(13) SQL statement selects all customers with a CustomerName ending with "a":
(14) SQL statement selects all customers with a CustomerName that have "or" in any position:
SELECT * FROM Customers
(15) selects all customers with a CustomerName that have "r" in the second position
(16) selects all customers with a CustomerName that starts with "a" and are at least 3 characters in
length:
(17) selects all customers with a first_Name that does NOT start with "a":
(18) statement selects all customers with first name containing the pattern "es":
(19) selects all customers with a first name starting with "a", "b", or "c":