SQL Exercises 3 — Wildcard & Special Operators

1. Find the details of those salespeople who come from the ‘Paris’ City or ‘Rome’ City. Return salesman_id, name, city, commission.

2. Find the details of those salespeople who live in cities apart from ‘Paris’ and ‘Rome’. Return salesman_id, name, city, commission.

3. Find the details of salespeople who get the commission in the range from 0.12 to 0.14 (begin and end values are included). Return salesman_id, name, city, and commission.

4. Find the details of those salespeople whose name starts with any letter within ‘A’ and ‘L’. Return salesman_id, name, city, commission.

5. Find the details of all salespeople except whose name starts with any letter within ‘A’ and ‘L’. Return salesman_id, name, city, commission.

6. Find the details of those salespeople whose name starts with ’N’ and the fourth character is ‘l’. Rests may be any character. Return salesman_id, name, city, commission.

1. Find the details of the customers whose ID belongs to any of the values 3007, 3008 and 3009. Return customer_id, cust_name, city, grade, and salesman_id.

2. Find the details of the customers whose name begins with the letter ‘B’. Return customer_id, cust_name, city, grade, salesman_id.

3. Find the details of the customers whose names end with the letter ’n’. Return customer_id, cust_name, city, grade, salesman_id.

4. Find all those customers who does not have any grade. Return customer_id, cust_name, city, grade, salesman_id.

5. Find all those customers whose grade value exists. Return customer_id, cust_name, city, grade, salesman_id.

1. Select orders value within a range 500, 400 (begin and end values are included). Exclude orders amount 948.50 and 1983.43. Return ord_no, purch_amt, ord_date, customer_id, and salesman_id.

1. Find those rows where col1 contains the escape character underscore ( _ ). Return col1.

2. Find those rows where col1 does not contain the escape character underscore ( _ ). Return col1.

3. Find those rows where col1 contains the forward slash character ( / ). Return col1.

4. Find those rows where col1 does not contain the forward slash character ( / ). Return col1.

5. Find those rows where col1 contains the string ( _/ ). Return col1.

6. Find those rows where col1 does not contain the string ( _/ ). Return col1.

7. Find those rows where col1 contains the character percent ( % ). Return col1.

8. Find those rows where col1 does not contain the character percent ( % ). Return col1.

1. Find the employees whose last name begins with the character ‘D’. Return emp_idno, emp_fname, emp_lname and emp_dept.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store