EMP / DEPT Schema ยท 238 Practice Prompts

SQL Practice Questions

Cleaned up and reorganized by topic, from the original Vaarahi Cloud Technologies worksheet. Every question below is renumbered to match the original sheet โ€” hints (๐Ÿ’ก) are added to the ones that trip people up.

Source: SQL_Practice_Questions.pdf ยท Tables: EMPY (aliased as EMP throughout) and DEPT

The two tables every question runs against

An employee table (EMPY, referred to as EMP in every question) and a department table (DEPT). Fourteen employees, four departments โ€” small enough to reason about by hand, which is what makes it good for practice.

EmpnoEnameJobMgrHiredateSalCommDeptnoGrade
7369SMITHCLERK79021980-12-17800โ€”205
7499ALLENSALESMAN76981981-02-201600300303
7521WARDSALESMAN76981981-02-221250500304
7566JONESMANAGER78391981-04-022975โ€”202
7654MARTINSALESMAN76981981-09-2812501400304
7698BLAKEMANAGER78391981-05-012850โ€”302
7782CLARKMANAGER78391981-06-092450โ€”102
7788SCOTTANALYST75661982-12-093000โ€”201
7839KINGPRESIDENTโ€”1981-11-175000โ€”101
7844TURNERSALESMAN76981981-09-081500โ€”303
7876ADAMSCLERK77881983-01-121100โ€”204
7900JAMESCLERK76981981-12-03950โ€”305
7902FORDANALYST75661981-12-033000โ€”201
7934MILLERCLERK77821982-01-231300โ€”103
DeptnoDnameLoc
10ACCOUNTINGNEW YORK
20RESEARCHDALLAS
30SALESCHICAGO
40OPERATIONSBOSTON

KING is the President and has no manager โ€” several questions below (50, 69, 151, 224...) hinge on that NULL.

Section 1

Basic Retrieval & Sorting

SELECT, DISTINCT, and ORDER BY โ€” the questions that get you comfortable pulling rows out and putting them in order.

  1. Q1
    Display every column of the EMP table.
    Hint
    This one's given to you in the sheet: SELECT * FROM EMP;
  2. Q2
    Display the unique job titles in the EMP table.
  3. Q3
    List the employees sorted by salary, ascending.
  4. Q4
    List the employee details sorted by department number ascending, then by job descending.
    Hint
    Two-column sort: ORDER BY deptno ASC, job DESC. Each column can have its own direction.
  5. Q5
    Display the distinct job groups sorted in descending order.
  6. Q6
    Display the full details of every "Manager".
Section 2

Ranges, Wildcards & Dates

Comparison operators, BETWEEN, IN, and LIKE pattern matching โ€” plus the date arithmetic that trips most people up first.

  1. Q7
    List employees who joined before 1981.
  2. Q8
    List Empno, Ename, Sal, and a computed "daily salary" for every employee, sorted by annual salary ascending.
    Hint
    "Daily sal" and "Annsal" aren't real columns โ€” you compute them: sal/30 AS daily_sal and sal*12 AS annsal, then ORDER BY annsal.
  3. Q9
    Display Empno, Ename, Job, Hiredate, and experience (years since hire) for every manager.
    Hint
    "Exp" means years of service: something like (CURRENT_DATE - hiredate)/365 depending on your SQL dialect's date functions.
  4. Q10
    List Empno, Ename, Sal, and experience of everyone who reports to manager number 7369.
  5. Q11
    Display everyone whose commission is greater than their salary.
    Hint
    Only salespeople have a commission โ€” everyone else is NULL, and NULL > sal is never true, so they're automatically excluded.
  6. Q12
    List employees who joined after the second half of 1981, sorted by job title ascending.
    Hint
    "Second half of 1981" starts 1-Jul-1981 โ€” filter with hiredate > '1981-07-01'.
  7. Q13
    List employees along with their experience, where daily salary is more than Rs.100.
  8. Q14
    List employees who are either a CLERK or an ANALYST, sorted descending.
  9. Q15
    List employees who joined on 1-May-81, 3-Dec-81, 17-Dec-81, or 19-Jan-80, in order of seniority.
    Hint
    A list of exact dates to match is exactly what WHERE hiredate IN (...) is for.
  10. Q16
    List employees working in department 10 or 20.
  11. Q17
    List employees who joined in the year 1981.
  12. Q18
    List employees who joined in August 1980.
  13. Q19
    List employees whose annual salary is between 22,000 and 45,000.
    Hint
    Remember annual salary = sal * 12, not the raw sal column โ€” so the condition applies to the computed value.

Same section, moving into LIKE wildcard matching on names and dates.

  1. Q20
    List employee names that are exactly five characters long.
    Hint
    Each underscore in LIKE matches exactly one character: ename LIKE '_____' (five underscores).
  2. Q21
    List employee names that start with 'S' and are five characters long.
    Hint
    ename LIKE 'S____' โ€” one literal letter, then four underscores.
  3. Q22
    List employees whose name is four characters long, with 'r' as the third character.
    Hint
    ename LIKE '__r_' โ€” count the underscores carefully on both sides of the fixed letter.
  4. Q23
    List the five-character names that start with 'S' and end with 'H'.
  5. Q24
    List employees who joined in January.
  6. Q25
    List employees who joined in a month whose second letter is 'a'.
    Hint
    Format the hire date's month name as text first, then pattern-match: something like TO_CHAR(hiredate,'MON') LIKE '_a%'. Think through which months qualify (Jan, Mar, May...) before you run it.
  7. Q26
    List employees whose salary is a four-digit number ending in zero.
    Hint
    Two conditions at once: sal BETWEEN 1000 AND 9999 and sal LIKE '%0' (cast to text first if your dialect needs it).
  8. Q27
    List employees whose name contains the letters "ll" together.
  9. Q28
    List employees who joined sometime in the 1980s.
Section 3

NOT & Exclusion Logic, then Joining EMP with DEPT

First the negative filters (NOT IN, <>, NOT LIKE), then bringing DEPT into the picture with joins.

  1. Q29
    List employees who do not belong to department 20.
  2. Q30
    List all employees except the PRESIDENT and MANAGERs, sorted by salary ascending.
  3. Q31
    List all employees who joined before or after 1981.
    Hint
    Read literally, "before or after 1981" just excludes anyone hired during 1981 โ€” equivalent to hiredate NOT BETWEEN '1981-01-01' AND '1981-12-31'.
  4. Q32
    List employees whose Empno does not start with the digits 78.
  5. Q33
    List employees who work under a manager (i.e., their Mgr column is not empty).
  6. Q34
    List employees who joined in any year, but not in the month of March.
  7. Q35
    List all clerks in department 20.
  8. Q36
    List employees in department 30 or 10 who joined in 1981.
  1. Q37
    Display the details of SMITH.
  2. Q38
    Display the location where SMITH works.
    Hint
    SMITH's row doesn't have a location โ€” that lives in DEPT. You need a join: EMP โ†’ DEPT on deptno.
  3. Q39
    List every EMP column plus Dname and Loc, for employees in ACCOUNTING and RESEARCH, sorted by department number ascending.
  4. Q40
    List Empno, Ename, Sal, and Dname for all Managers and Analysts working in New York or Dallas, with more than 7 years' experience, who receive no commission โ€” sorted by location.
    Hint
    Break it into pieces before writing SQL: job filter, location filter (via the joined DEPT table), experience filter, and comm IS NULL. AND them all together.
  5. Q41
    Display Empno, Ename, Sal, Dname, Loc, Deptno, and Job for employees who either work at Chicago or work in Accounting, with annual salary over 28,000 โ€” excluding anyone earning exactly 3000 or 2800, who reports to no manager, and whose employee number has a '7' or '8' in the third position. Sort by department number ascending, then job descending.
    Hint
    This is several of the earlier questions stacked together. Write one condition at a time and test each independently before combining with AND/OR โ€” don't try to write it in one pass. The "digit in 3rd position" part needs a LIKE '__7%' OR LIKE '__8%' style pattern.
Section 4

Working with Grades

The Grade column (1โ€“5) layered on top of everything from Sections 1โ€“3.

  1. Q42
    Display every employee's details along with their Grade, sorted ascending.
  2. Q43
    List all Grade 2 and Grade 3 employees.
  3. Q44
    Display all Grade 4 and 5 Analysts and Managers.
  4. Q45
    List Empno, Ename, Sal, Dname, Grade, Exp, and annual salary for employees in department 10 or 20.
  5. Q46
    List every column plus Loc and Grade, for employees with Grade 2โ€“4, in departments whose name doesn't start with "OP" and doesn't end with "S", whose job title contains the letter 'a' anywhere, who joined in 1981 but not in March or September, and whose salary doesn't end in "00" โ€” sorted by Grade ascending.
    Hint
    The most stacked question on the sheet. Build it clause by clause: grade BETWEEN 2 AND 4, dname NOT LIKE 'OP%' AND dname NOT LIKE '%S', job LIKE '%a%', year + month exclusion on hiredate, and sal NOT LIKE '%00'. Verify each piece against the sample data before joining them all.
  6. Q47
    List department details along with Empno and Ename โ€” including departments that have no employees.
    Hint
    "With or without employees" is the giveaway for an outer join: DEPT LEFT JOIN EMP (department 40, Boston, has nobody in it).
Section 5

Subqueries vs. a Named Employee

"More than X", "same job as Y" โ€” single-row subqueries where the comparison value comes from another row in the same table.

  1. Q48
    List employees whose salary is more than BLAKE's.
  2. Q49
    List employees whose job matches ALLEN's.
  3. Q50
    List employees who are senior (joined earlier) to KING.
  4. Q51
    List employees who are senior to their own manager.
    Hint
    This needs the EMP table joined to itself โ€” one copy for the employee, one for their manager โ€” comparing hire dates between the two copies.
  5. Q52
    List employees in department 20 whose job also exists in department 10.
  6. Q53
    List employees whose salary matches FORD's or SMITH's, sorted by salary descending.
  7. Q54
    List employees whose job matches MILLER's, or whose salary is more than ALLEN's.
  8. Q55
    List employees whose salary is greater than the combined total pay of all salesmen.
    Hint
    "Combined total" means you need SUM(sal) in the subquery, not a plain column comparison.
  9. Q56
    List employees senior to BLAKE who work in Chicago or Boston.
  10. Q57
    List Grade 3โ€“4 employees in Accounting or Research whose salary beats ALLEN's and whose experience beats SMITH's, sorted by experience ascending.
  11. Q58
    List employees whose job matches SMITH's or ALLEN's.
  12. Q59
    Display employees whose salary matches any salary paid in department 10, but only where that same salary doesn't also appear in department 20.
    Hint
    Two nested conditions: sal IN (SELECT sal FROM emp WHERE deptno=10) combined with sal NOT IN (SELECT sal FROM emp WHERE deptno=20).
Section 6

Set Operators

One short question โ€” but it's the one place on the sheet that calls for MINUS/EXCEPT instead of a WHERE clause.

  1. Q60
    List employees in an "emp1" table who don't appear in an "emp2" table.
    Hint
    This is the textbook use case for MINUS (or EXCEPT in some dialects): SELECT * FROM emp1 MINUS SELECT * FROM emp2.
Section 7

Aggregate Functions

MAX, MIN, SUM, AVG โ€” plus the recently-hired and highest-paid questions that combine an aggregate with a filter.

  1. Q61
    Find the highest salary in the EMP table.
  2. Q62
    Find the full details of the highest-paid employee.
    Hint
    MAX(sal) alone only gives you the number โ€” to get the whole row, filter with WHERE sal = (SELECT MAX(sal) FROM emp).
  3. Q63
    Find the highest-paid employee in the Sales department.
  4. Q64
    List the most recently hired Grade 3 employee working in Chicago.
  5. Q65
    List employees senior to the most recently hired employee working under KING.
  6. Q66
    List employees in New York with Grade 3โ€“5, excluding the PRESIDENT, whose salary beats the highest-paid employee in Chicago, within a group that contains both a Manager and a Salesman not reporting to KING.
    Hint
    Read this one twice before coding โ€” it layers a subquery (highest Chicago salary) on top of a GROUP BY/HAVING condition (a group containing both job types). Tackle the two halves separately first.
  7. Q67
    List the details of the most senior employee hired in 1981.
  8. Q68
    List employees who joined in 1981 whose job matches the most senior person hired that same year.
  9. Q69
    List the most senior employee reporting to KING whose Grade is above 3.
  10. Q70
    Find the total salary paid to Managers.
  11. Q71
    Find the total annual salary, broken down by job, for people hired in 1981.
  12. Q72
    Display the total salary paid to Grade 3 employees.
  13. Q73
    Display the average salary of all clerks.
  14. Q74
    List employees in department 20 whose salary is above the average salary in department 10.
    Hint
    The subquery computes one number โ€” AVG(sal) for dept 10 โ€” and the outer query filters dept 20 rows against it.
Section 8

GROUP BY & HAVING

Counting and aggregating per group, then filtering those groups โ€” the difference between WHERE and HAVING is the whole point of this section.

  1. Q75
    Display the number of employees for each job, broken down by department.
  2. Q76
    List each manager's number along with how many employees report to them, sorted by manager number ascending.
  3. Q77
    List department details where at least two employees work there.
    Hint
    Filtering on a group total needs HAVING COUNT(*) >= 2 โ€” a plain WHERE can't filter on an aggregate.
  4. Q78
    Display each Grade, how many employees are in it, and the max salary within it.
  5. Q79
    Display department name, grade, and number of employees, where at least two employees in that group are clerks.
  6. Q80
    List the details of the department with the most employees.
  1. Q96
    List the number of employees in each department where that count is more than 3.
  2. Q97
    List the names of departments where at least 3 people work.
  3. Q98
    List managers whose salary is more than the average salary of their own employees.
    Hint
    This needs a correlated subquery: for each manager row, compute AVG(sal) of employees whose mgr equals that manager's empno.
  4. Q99
    List name, salary, and commission for employees whose net pay is greater than or equal to any other employee's salary.
  5. Q100
    List the employee whose salary is less than their manager's, but more than any other manager's salary.
  6. Q101
    List employee names and their average salary, grouped by department.
Section 9

Self-Joins & Correlated Subqueries

Anything that compares an employee to their own manager needs the EMP table joined to a second copy of itself โ€” this is the section where that pattern shows up over and over.

  1. Q81
    Display the employees whose manager's name is JONES.
    Hint
    JONES's name is in the EMP table, but the column you filter on (mgr) stores JONES's number. Look up his empno first, or self-join.
  2. Q102
    Find the 5 lowest earners in the company.
  3. Q103
    Find employees whose salary is greater than their manager's.
  4. Q104
    List managers who don't report to the president.
  5. Q105
    List EMP rows whose department number doesn't exist in the DEPT table.
  6. Q106
    List name, salary, commission, and net pay for whoever earns more (net) than any other employee.
  7. Q139
    List managers who earn less than one of their own employees.
  8. Q140
    Print the details of everyone who reports (directly or via their chain) to BLAKE.
  9. Q141
    List employees working as managers, using a correlated subquery.
    Hint
    "Correlated" means the inner query references the outer row: WHERE EXISTS (SELECT 1 FROM emp e2 WHERE e2.mgr = e1.empno).
  10. Q142
    List employees whose manager is JONES, along with that manager's name.
  11. Q150
    Find employees who joined the company before their own manager did.
  12. Q151
    List every employee's name and number next to their manager's name and number โ€” including KING, who has no manager.
    Hint
    KING must still appear, so this self-join needs to be a LEFT JOIN on the manager side, not an inner join.
Section 10

String, Character & Date Functions

SUBSTR, LENGTH, UPPER/LOWER, and date arithmetic โ€” the functions section, where reading the question carefully matters more than the SQL itself.

  1. Q107
    List employees whose retirement date (assuming a 20-year max job period) falls after 31-Dec-89.
    Hint
    Compute a retirement date per employee โ€” hiredate + 20 years โ€” then filter on that computed value.
  2. Q108
    List employees whose salary is an odd number.
    Hint
    MOD(sal, 2) = 1 โ€” the classic odd/even check.
  3. Q109
    List employees whose salary has exactly 3 digits.
  4. Q110
    List employees who joined in December.
  5. Q111
    List employees whose name contains the letter 'A'.
  6. Q112
    List employees whose department number appears somewhere inside their salary figure.
    Hint
    Convert salary to text and check whether the deptno substring occurs in it, e.g. CAST(sal AS TEXT) LIKE '%' || deptno || '%'.
  7. Q113
    List employees where the first 2 characters of their hire date match the last 2 characters of their salary.
  8. Q114
    List employees where 10% of their salary equals their year of joining.
  9. Q115
    List names with the first half in lowercase and the second half in uppercase.
    Hint
    Split the name at its midpoint with SUBSTR/LENGTH, lowercase one half, uppercase the other, then concatenate them back together.
  10. Q116
    List department names where the number of employees equals the number of characters in the department name.
  11. Q117
    List employees who joined before the 15th of the month.
  12. Q118
    List a department name whose character count matches the employee count of some other department.
  13. Q119
    List employees working as Managers.
  14. Q120
    List the name of the department with the highest number of employees.
  15. Q121
    Count how many employees are Managers, using a set-based COUNT (not a loop).
  16. Q122
    List employees who joined the company on the same date as another employee.
  17. Q123
    List employees whose Grade equals one-tenth of the Sales department's number.
  18. Q124
    List department names where more than the average number of employees work.
  19. Q125
    List the manager with the most employees reporting to them.
  20. Q136
    Count the characters in each name, not counting spaces.
  21. Q137
    Find employees whose salary has a decimal value โ€” without using LIKE.
    Hint
    Compare the salary to its own rounded-down value: if sal <> TRUNC(sal), there's a fractional part.
  22. Q138
    List employees whose salary starts with the same first four digits as their department number.
  23. Q146
    Check whether all employee numbers in the table are actually unique.
    Hint
    Group by empno and look for any group with COUNT(*) > 1 โ€” if nothing comes back, they're all unique.
Section 11

DECODE, CASE & Formatted Output

Turning raw columns into human-readable, conditional, or specially-formatted output โ€” column aliases, CASE/DECODE, and date formatting.

  1. Q126
    List Ename and salary increased by 15%, labeled in dollars.
  2. Q127
    Produce output from EMP with columns titled "EMP_AND_JOB" for Ename and Job.
    Hint
    This is just about column aliases: SELECT ename AS EMP, job AS AND_JOB ... โ€” the "output" is the column header, via AS.
  3. Q128
    Reproduce this exact layout from the EMP table:
    EMPLOYEE
    SMITH (clerk)
    ALLEN (Salesman)
    Hint
    Build one concatenated string per row: ename || ' (' || LOWER(job) || ')', with "EMPLOYEE" as the column heading.
  4. Q130
    List employees with their hire date formatted like "June 4, 1988".
    Hint
    A date-formatting function is what you want here โ€” TO_CHAR(hiredate, 'Month DD, YYYY') in Oracle-flavored SQL, or the equivalent in your dialect.
  5. Q131
    Label each employee "just salary" if salary is more than 1500, "on target" if exactly 1500, and "below 1500" if under 1500.
    Hint
    Three-way branching is a job for CASE WHEN ... THEN ... WHEN ... THEN ... ELSE ... END (or DECODE with a comparison trick).
  6. Q132
    Write a query that returns the day of the week for any date entered in 'DD-MM-YY' format.
  7. Q133
    Calculate each employee's length of service โ€” define a reusable expression so you're not retyping the date math every time.
  8. Q134
    Given a string in 'NN/NN' format, verify the first two and last two characters are digits and the middle character is '/'. Print 'YES' if valid, 'NO' otherwise. Test with '12/34', '01/1a', '99/98'.
    Hint
    A regex-style check works well: does the string match the pattern of two digits, a slash, two digits? Any SQL dialect with regex (REGEXP_LIKE or similar) makes this a one-liner; without regex, check each character position with SUBSTR.
  9. Q135
    Employees hired on or before the 15th of a month are paid on the last Friday of that month; those hired after the 15th are paid on the first Friday of the following month. List each employee's hire date and their first pay date, sorted by hire date.
    Hint
    The trickiest date question here โ€” it's a CASE split on "day of month <= 15", with each branch computing "next Friday" or "last Friday of month" using your dialect's date functions. Work out the logic on paper for one or two employees before coding.
  10. Q181
    List Empno, Ename, Sal, and a full payroll breakdown โ€” TA at 30%, DA at 40%, HRA at 50%, Gross, LIC, PF, Net, Deduction, Net Allowance, and Net Salary โ€” sorted by net salary ascending.
    Hint
    There's no fixed formula given โ€” this is a "design your own payroll calculation" exercise. Define each component as a percentage of sal, decide reasonable deduction rates for LIC/PF, and chain them into Gross โ†’ Net.
Section 12

Advanced Correlated Subqueries

Comparing employees to a named person (with their manager also shown), and to expressions defined once and reused.

  1. Q143
    Define a variable for "total annual remuneration" and use it to find everyone earning 30,000 a year or more.
  2. Q144
    Find out how many Managers there are in the company.
  3. Q145
    Find average salary and average total remuneration for each job type โ€” remember, salesmen also earn commission.
    Hint
    "Total remuneration" = sal + comm. Since comm is NULL for non-salespeople, wrap it in COALESCE(comm, 0) (or NVL) so the addition doesn't wipe out the whole row.
  4. Q147
    List employees earning less than 1000, sorted by salary.
  5. Q148
    List employee name, job, annual salary, department number, department name, and grade for those who earn 36,000 a year, or who are not clerks.
  6. Q149
    Find which job was filled in the first half of 1983, and whether that same job was also filled in the same period of 1984.
  7. Q152
    Find everyone who earns the minimum salary for their job, sorted ascending.
  8. Q153
    Find everyone who earns the highest salary within their job type, sorted by salary descending.
    Hint
    Same shape as Q152 but flipped โ€” compare each row's salary to MAX(sal) within a GROUP BY job subquery.
  9. Q154
    Find the most recently hired employee in each department, sorted by hire date.
  10. Q155
    List employee name, salary, and department number for anyone earning more than their department's average, sorted by department.
  11. Q156
    List department numbers that have no employees at all.
  12. Q157
    List the employee count and average salary, broken down by department and job.
  13. Q158
    Find the highest average salary drawn for any job, excluding the President.
  14. Q159
    Find the name and job of whoever earns both the max salary and the max commission.
  15. Q160
    List name, job, and salary for employees outside department 10 who share the same job and salary as someone inside department 10.
Section 13

Top-N & Ranking Queries

"Highest", "second-highest", "least" โ€” ranking-flavored questions that usually need a subquery rather than a simple ORDER BY + LIMIT.

  1. Q161
    List Deptno, Name, Job, Salary, and Sal+Comm for the salesman earning the highest combined salary and commission, descending.
  2. Q162
    List Deptno, Name, Job, Salary, and Sal+Comm for whoever has the second-highest combined earnings (salary + commission).
    Hint
    "Second highest" is the classic trap. One reliable pattern: find the max, then find the max of everything below that max โ€” MAX(salcomm) WHERE salcomm < (SELECT MAX(salcomm) FROM ...).
  3. Q163
    List department numbers and their average salary, for departments whose average is below the average across all departments.
  4. Q164
    List names and salaries of employees, alongside their manager's name and salary, for employees who out-earn their manager.
  5. Q165
    List name, job, and salary of employees in the department that has the highest average salary.
  6. Q235
    List the highest-paid employee in the company.
  7. Q236
    List the details of the most recently hired employee in department 30.
  8. Q237
    List the highest-paid employee in Chicago who joined before the most recently hired Grade 2 employee.
  9. Q238
    List the highest-paid employee reporting to KING.
From here on, the sheet repeats earlier topics as a second practice pass โ€” same concepts, fresh wording, meant to be attempted after Sections 1โ€“13 rather than as new material.
Section 14 ยท Review Round

Retrieval & Filtering, Revisited

  1. Q166
    List Empno, Sal, and Comm for every employee.
  2. Q167
    List employee details sorted by salary ascending.
  3. Q168
    List departments sorted by job ascending and employees descending; print Empno and Ename.
  4. Q169
    Display the unique departments employees belong to.
  5. Q170
    Display the unique department-and-job combinations.
  6. Q171
    Display BLAKE's details.
  7. Q172
    List all clerks.
  8. Q173
    List employees who joined on 1st May 1981.
  9. Q174
    List Empno, Ename, Sal, Deptno for department 10 employees, sorted by salary ascending.
  10. Q175
    List employees whose salary is less than 3500.
  11. Q176
    List Empno, Ename, Sal for employees who joined before 1 April 1981.
  12. Q177
    List employees whose annual salary is under 25,000, sorted ascending.
  13. Q178
    List Empno, Ename, annual salary, and daily salary for all salesmen, sorted by annual salary ascending.
  14. Q179
    List Empno, Ename, Hiredate, current date, and experience, sorted by experience ascending.
  15. Q180
    List employees with more than 10 years of experience.
Section 15 ยท Review Round

Joins, Grades & Patterns, Revisited

  1. Q182
    List employees working as managers.
  2. Q183
    List employees who are either clerks or managers.
  3. Q184
    List employees hired on 1 May 81, 17 Nov 81, or 30 Dec 81.
  4. Q185
    List employees who joined in 1981.
  5. Q186
    List employees whose annual salary is between 23,000 and 40,000.
  6. Q187
    List employees reporting to managers 7369, 7890, 7654, or 7900.
  7. Q188
    List employees who joined in the second half of 1982.
  8. Q189
    List all employees with a 4-character name.
  9. Q190
    List employee names starting with 'M' with 5 characters.
  10. Q191
    List employees whose 5-character name ends with 'H'.
  11. Q192
    List names starting with 'M'.
  12. Q193
    List employees who joined in 1981.
  13. Q194
    List employees whose salary ends in "00".
  14. Q195
    List employees who joined in January.
  15. Q196
    List employees who joined in a month containing the letter 'a'.
  16. Q197
    List employees who joined in a month whose second letter is 'a'.
  17. Q198
    List employees whose salary is a 4-digit number.
  18. Q199
    List employees who joined in the 1980s.
  19. Q200
    List clerks with more than 8 years of experience.
  20. Q201
    List the managers of department 10 or 20.
  21. Q202
    List employees who joined in January with salary between 1500 and 4000.
  22. Q203
    List the unique jobs in departments 20 and 30, descending.
  23. Q209
    List the details of employees working at Chicago.
  24. Q210
    List Empno, Ename, Deptno, Loc for every employee.
  25. Q211
    List Empno, Ename, Loc, Dname for departments 10 and 20.
  26. Q212
    List Empno, Ename, Sal, Loc for employees at Chicago or Dallas with more than 6 years' experience.
  27. Q213
    List employees along with location, for those in Dallas or New York with salary 2000โ€“5000, who joined in 1981.
  28. Q214
    List Empno, Ename, Sal, Grade for every employee.
  29. Q215
    List the Grade 2 and 3 employees in Chicago.
  30. Q216
    List employees with location and grade, in Accounting, or in Dallas/Chicago with Grade 3โ€“5 and over 6 years' experience.
  31. Q217
    List the Grade 3 employees of Research and Operations who joined after 1987 and whose name isn't MILLER or ALLEN.
Section 16 ยท Review Round

Comparisons & Self-Joins, Revisited

  1. Q218
    List employees whose job matches SMITH's.
  2. Q219
    List employees senior to MILLER.
  3. Q220
    List employees whose job matches ALLEN's, or whose salary beats ALLEN's.
  4. Q221
    List employees senior to their own manager.
  5. Q222
    List employees whose salary beats BLAKE's.
  6. Q223
    List department 10 employees whose salary beats ALLEN's.
  7. Q224
    List managers who are senior to KING but junior to SMITH.
    Hint
    "Senior to X" means hired earlier than X; "junior to Y" means hired later than Y โ€” combine both date comparisons.
  8. Q225
    List Empno, Ename, Loc, Sal, Dname for every employee in KING's department.
  9. Q226
    List employees whose salary grade beats MILLER's.
  10. Q227
    List employees in Dallas or Chicago whose grade matches ADAMS's, or whose experience beats SMITH's.
  11. Q228
    List employees whose salary matches FORD's or BLAKE's.
  12. Q229
    List employees whose salary matches any one of a given set of values.
  13. Q230
    Find any clerk's salary from an "emp1" table.
  14. Q231
    Find any employee from an "emp2" table who joined before 1982.
  15. Q232
    Find the total remuneration (salary + commission) of every salesperson in the Sales department, from an "emp3" table.
  16. Q233
    Find any Grade 4 employee's salary from an "emp4" table.
  17. Q234
    Find any employee's salary from an "emp5" table.
Section 17

Challenge Queries

The last stretch of the sheet โ€” the most heavily stacked, multi-clause questions, saved for once everything above feels comfortable.

  1. Q204
    List employees with experience, working under a manager whose number starts with 7 but doesn't contain a 9, who joined before 1983.
  2. Q205
    List employees working as either Manager or Analyst, with salary 2000โ€“5000 and no commission.
  3. Q206
    List Empno, Ename, Sal, Job for employees with annual salary under 34,000 who do receive commission (but not more than their salary), working as a salesman in department 30.
  4. Q207
    List employees in department 10 or 20, as clerk or analyst, with a 3- or 4-digit salary, over 8 years' experience, not hired in March/April/September, who report to a manager, and whose employee number doesn't end in 88 or 56.
  5. Q208
    List Empno, Ename, Sal, Job, Deptno, and Exp for employees in department 10 or 20, with 6โ€“10 years' experience, reporting to the same manager, with no commission, in a job title not ending in a specific pattern, with commission over 200, experience โ‰ฅ 7 years, salary under 2500, not hired in September or November, reporting to a manager whose number contains neither 9 nor 0 โ€” sorted by department ascending, then descending.
    Hint
    The single most stacked question on the sheet, and a couple of its conditions even contradict each other as written (no commission, and commission over 200) โ€” treat it as a checklist rather than one query: list every condition on its own line, resolve the contradiction with your instructor's intent, then AND together only the pieces that are actually compatible.