SQL Exercises 2 — Boolean & Relational Operators

1. Find the details of the customers who have a grade value above 100. Return customer_id, cust_name, city, grade, and salesman_id.

2. Find all the customers in ‘New York’ city who have a grade value above 100. Return customer_id, cust_name, city, grade, and salesman_id.

3. Find the customers who belong to either the city ‘New York’ or have a grade above 100. Return customer_id, cust_name, city, grade, and salesman_id.

4. Find the customers who belong to either the city ‘New York’ or not have a grade above 100. Return customer_id, cust_name, city, grade, and salesman_id.

5. Find those customers who belong to neither the ‘New York’ city nor their grade value exceeds 100. Return customer_id, cust_name, city, grade, and salesman_id.

1. Find details of all order excluding combination of ord_date equal to ‘2012–09–10’ and salesman_id higher than 5005 or purch_amt greater than 1000. Return ord_no, purch_amt, ord_date, customer_id and salesman_id.

2. Find details of all order where purchase amount less than 200 or excluding combination of order date greater than or equal to ‘2012–02–10’ and customer ID less than 3009. Return ord_no, purch_amt, ord_date, customer_id and salesman_id.

3. Find all orders subject to following conditions. Exclude combination of order date equal to ‘2012–08–17’ or customer ID higher than 3005 and purchase amount less than 1000.

4. Display order number, purchase amount, achieved, the unachieved percentage for those order which exceeds the 50% of the target value of 6000.

1. Find the details of those salespeople whose commissions range from 0.10 to 0.12. Return salesman_id, name, city, and commission.

1. Find the details of all employees whose last name is ‘Dosni’ or ‘Mardy’. Return emp_idno, emp_fname, emp_lname, and emp_dept.

2. Find the employees who works at depart 47 or 63. 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