QUERIES FOR PRACTICE(simple)
QUERIES FOR PRACTICE(simple)
8. -- Selecting the 'grade' column and the count of rows from the 'customer' table
GROUP BY grade
(SELECT AVG(grade)
FROM customer
FROM orders
WHERE salesman_id IN (
SELECT salesman_id
FROM salesman
WHERE commission = (
SELECT MAX(commission)
-- Selecting all columns from the 'orders' table and the 'cust_name' column from the
'customer' table
Solutions
1. SELECT id, name FROM Employees WHERE id NOT IN (SELECT employee_id FROM
Awards);
2. SELECT id, name FROM Employees WHERE id NOT IN (SELECT employee_id FROM
Awards);
3. SELECT * FROM Employees WHERE role = 'Developer' AND salary > ALL ( SELECT salary
FROM Employees WHERE role = 'Manager');
4. SELECT * FROM Employees WHERE role = 'Developer' AND salary > ANY ( SELECT salary
FROM Employees WHERE role = 'Manager');
5. SELECT * FROM Employees emp1 WHERE salary > ( SELECT AVG(salary) FROM Employees
emp2 WHERE emp1.role = emp2.role );