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.
| Empno | Ename | Job | Mgr | Hiredate | Sal | Comm | Deptno | Grade |
|---|---|---|---|---|---|---|---|---|
| 7369 | SMITH | CLERK | 7902 | 1980-12-17 | 800 | โ | 20 | 5 |
| 7499 | ALLEN | SALESMAN | 7698 | 1981-02-20 | 1600 | 300 | 30 | 3 |
| 7521 | WARD | SALESMAN | 7698 | 1981-02-22 | 1250 | 500 | 30 | 4 |
| 7566 | JONES | MANAGER | 7839 | 1981-04-02 | 2975 | โ | 20 | 2 |
| 7654 | MARTIN | SALESMAN | 7698 | 1981-09-28 | 1250 | 1400 | 30 | 4 |
| 7698 | BLAKE | MANAGER | 7839 | 1981-05-01 | 2850 | โ | 30 | 2 |
| 7782 | CLARK | MANAGER | 7839 | 1981-06-09 | 2450 | โ | 10 | 2 |
| 7788 | SCOTT | ANALYST | 7566 | 1982-12-09 | 3000 | โ | 20 | 1 |
| 7839 | KING | PRESIDENT | โ | 1981-11-17 | 5000 | โ | 10 | 1 |
| 7844 | TURNER | SALESMAN | 7698 | 1981-09-08 | 1500 | โ | 30 | 3 |
| 7876 | ADAMS | CLERK | 7788 | 1983-01-12 | 1100 | โ | 20 | 4 |
| 7900 | JAMES | CLERK | 7698 | 1981-12-03 | 950 | โ | 30 | 5 |
| 7902 | FORD | ANALYST | 7566 | 1981-12-03 | 3000 | โ | 20 | 1 |
| 7934 | MILLER | CLERK | 7782 | 1982-01-23 | 1300 | โ | 10 | 3 |
| Deptno | Dname | Loc |
|---|---|---|
| 10 | ACCOUNTING | NEW YORK |
| 20 | RESEARCH | DALLAS |
| 30 | SALES | CHICAGO |
| 40 | OPERATIONS | BOSTON |
KING is the President and has no manager โ several questions below (50, 69, 151, 224...) hinge on that NULL.
Basic Retrieval & Sorting
SELECT, DISTINCT, and ORDER BY โ the questions that get you comfortable pulling rows out and putting them in order.
- Q1Display every column of the EMP table.
Hint
This one's given to you in the sheet:SELECT * FROM EMP; - Q2Display the unique job titles in the EMP table.
- Q3List the employees sorted by salary, ascending.
- Q4List 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. - Q5Display the distinct job groups sorted in descending order.
- Q6Display the full details of every "Manager".
Ranges, Wildcards & Dates
Comparison operators, BETWEEN, IN, and LIKE pattern matching โ plus the date arithmetic that trips most people up first.
- Q7List employees who joined before 1981.
- Q8List 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_salandsal*12 AS annsal, thenORDER BY annsal. - Q9Display Empno, Ename, Job, Hiredate, and experience (years since hire) for every manager.
Hint
"Exp" means years of service: something like(CURRENT_DATE - hiredate)/365depending on your SQL dialect's date functions. - Q10List Empno, Ename, Sal, and experience of everyone who reports to manager number 7369.
- Q11Display everyone whose commission is greater than their salary.
Hint
Only salespeople have a commission โ everyone else isNULL, andNULL > salis never true, so they're automatically excluded. - Q12List employees who joined after the second half of 1981, sorted by job title ascending.
Hint
"Second half of 1981" starts 1-Jul-1981 โ filter withhiredate > '1981-07-01'. - Q13List employees along with their experience, where daily salary is more than Rs.100.
- Q14List employees who are either a CLERK or an ANALYST, sorted descending.
- Q15List 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 whatWHERE hiredate IN (...)is for. - Q16List employees working in department 10 or 20.
- Q17List employees who joined in the year 1981.
- Q18List employees who joined in August 1980.
- Q19List employees whose annual salary is between 22,000 and 45,000.
Hint
Remember annual salary =sal * 12, not the rawsalcolumn โ so the condition applies to the computed value.
Same section, moving into LIKE wildcard matching on names and dates.
- Q20List employee names that are exactly five characters long.
Hint
Each underscore inLIKEmatches exactly one character:ename LIKE '_____'(five underscores). - Q21List employee names that start with 'S' and are five characters long.
Hint
ename LIKE 'S____'โ one literal letter, then four underscores. - Q22List 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. - Q23List the five-character names that start with 'S' and end with 'H'.
- Q24List employees who joined in January.
- Q25List 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 likeTO_CHAR(hiredate,'MON') LIKE '_a%'. Think through which months qualify (Jan, Mar, May...) before you run it. - Q26List employees whose salary is a four-digit number ending in zero.
Hint
Two conditions at once:sal BETWEEN 1000 AND 9999andsal LIKE '%0'(cast to text first if your dialect needs it). - Q27List employees whose name contains the letters "ll" together.
- Q28List employees who joined sometime in the 1980s.
NOT & Exclusion Logic, then Joining EMP with DEPT
First the negative filters (NOT IN, <>, NOT LIKE), then bringing DEPT into the picture with joins.
- Q29List employees who do not belong to department 20.
- Q30List all employees except the PRESIDENT and MANAGERs, sorted by salary ascending.
- Q31List all employees who joined before or after 1981.
Hint
Read literally, "before or after 1981" just excludes anyone hired during 1981 โ equivalent tohiredate NOT BETWEEN '1981-01-01' AND '1981-12-31'. - Q32List employees whose Empno does not start with the digits 78.
- Q33List employees who work under a manager (i.e., their Mgr column is not empty).
- Q34List employees who joined in any year, but not in the month of March.
- Q35List all clerks in department 20.
- Q36List employees in department 30 or 10 who joined in 1981.
- Q37Display the details of SMITH.
- Q38Display the location where SMITH works.
Hint
SMITH's row doesn't have a location โ that lives in DEPT. You need a join: EMP โ DEPT ondeptno. - Q39List every EMP column plus Dname and Loc, for employees in ACCOUNTING and RESEARCH, sorted by department number ascending.
- Q40List 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, andcomm IS NULL. AND them all together. - Q41Display 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 aLIKE '__7%' OR LIKE '__8%'style pattern.
Working with Grades
The Grade column (1โ5) layered on top of everything from Sections 1โ3.
- Q42Display every employee's details along with their Grade, sorted ascending.
- Q43List all Grade 2 and Grade 3 employees.
- Q44Display all Grade 4 and 5 Analysts and Managers.
- Q45List Empno, Ename, Sal, Dname, Grade, Exp, and annual salary for employees in department 10 or 20.
- Q46List 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, andsal NOT LIKE '%00'. Verify each piece against the sample data before joining them all. - Q47List 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).
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.
- Q48List employees whose salary is more than BLAKE's.
- Q49List employees whose job matches ALLEN's.
- Q50List employees who are senior (joined earlier) to KING.
- Q51List 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. - Q52List employees in department 20 whose job also exists in department 10.
- Q53List employees whose salary matches FORD's or SMITH's, sorted by salary descending.
- Q54List employees whose job matches MILLER's, or whose salary is more than ALLEN's.
- Q55List employees whose salary is greater than the combined total pay of all salesmen.
Hint
"Combined total" means you needSUM(sal)in the subquery, not a plain column comparison. - Q56List employees senior to BLAKE who work in Chicago or Boston.
- Q57List Grade 3โ4 employees in Accounting or Research whose salary beats ALLEN's and whose experience beats SMITH's, sorted by experience ascending.
- Q58List employees whose job matches SMITH's or ALLEN's.
- Q59Display 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 withsal NOT IN (SELECT sal FROM emp WHERE deptno=20).
Set Operators
One short question โ but it's the one place on the sheet that calls for MINUS/EXCEPT instead of a WHERE clause.
- Q60List employees in an "emp1" table who don't appear in an "emp2" table.
Hint
This is the textbook use case forMINUS(orEXCEPTin some dialects):SELECT * FROM emp1 MINUS SELECT * FROM emp2.
Aggregate Functions
MAX, MIN, SUM, AVG โ plus the recently-hired and highest-paid questions that combine an aggregate with a filter.
- Q61Find the highest salary in the EMP table.
- Q62Find the full details of the highest-paid employee.
Hint
MAX(sal)alone only gives you the number โ to get the whole row, filter withWHERE sal = (SELECT MAX(sal) FROM emp). - Q63Find the highest-paid employee in the Sales department.
- Q64List the most recently hired Grade 3 employee working in Chicago.
- Q65List employees senior to the most recently hired employee working under KING.
- Q66List 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. - Q67List the details of the most senior employee hired in 1981.
- Q68List employees who joined in 1981 whose job matches the most senior person hired that same year.
- Q69List the most senior employee reporting to KING whose Grade is above 3.
- Q70Find the total salary paid to Managers.
- Q71Find the total annual salary, broken down by job, for people hired in 1981.
- Q72Display the total salary paid to Grade 3 employees.
- Q73Display the average salary of all clerks.
- Q74List 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.
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.
- Q75Display the number of employees for each job, broken down by department.
- Q76List each manager's number along with how many employees report to them, sorted by manager number ascending.
- Q77List department details where at least two employees work there.
Hint
Filtering on a group total needsHAVING COUNT(*) >= 2โ a plainWHEREcan't filter on an aggregate. - Q78Display each Grade, how many employees are in it, and the max salary within it.
- Q79Display department name, grade, and number of employees, where at least two employees in that group are clerks.
- Q80List the details of the department with the most employees.
- Q96List the number of employees in each department where that count is more than 3.
- Q97List the names of departments where at least 3 people work.
- Q98List managers whose salary is more than the average salary of their own employees.
Hint
This needs a correlated subquery: for each manager row, computeAVG(sal)of employees whosemgrequals that manager'sempno. - Q99List name, salary, and commission for employees whose net pay is greater than or equal to any other employee's salary.
- Q100List the employee whose salary is less than their manager's, but more than any other manager's salary.
- Q101List employee names and their average salary, grouped by department.
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.
- Q81Display 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. - Q102Find the 5 lowest earners in the company.
- Q103Find employees whose salary is greater than their manager's.
- Q104List managers who don't report to the president.
- Q105List EMP rows whose department number doesn't exist in the DEPT table.
- Q106List name, salary, commission, and net pay for whoever earns more (net) than any other employee.
- Q139List managers who earn less than one of their own employees.
- Q140Print the details of everyone who reports (directly or via their chain) to BLAKE.
- Q141List 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). - Q142List employees whose manager is JONES, along with that manager's name.
- Q150Find employees who joined the company before their own manager did.
- Q151List 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 aLEFT JOINon the manager side, not an inner join.
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.
- Q107List 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. - Q108List employees whose salary is an odd number.
Hint
MOD(sal, 2) = 1โ the classic odd/even check. - Q109List employees whose salary has exactly 3 digits.
- Q110List employees who joined in December.
- Q111List employees whose name contains the letter 'A'.
- Q112List 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 || '%'. - Q113List employees where the first 2 characters of their hire date match the last 2 characters of their salary.
- Q114List employees where 10% of their salary equals their year of joining.
- Q115List names with the first half in lowercase and the second half in uppercase.
Hint
Split the name at its midpoint withSUBSTR/LENGTH, lowercase one half, uppercase the other, then concatenate them back together. - Q116List department names where the number of employees equals the number of characters in the department name.
- Q117List employees who joined before the 15th of the month.
- Q118List a department name whose character count matches the employee count of some other department.
- Q119List employees working as Managers.
- Q120List the name of the department with the highest number of employees.
- Q121Count how many employees are Managers, using a set-based COUNT (not a loop).
- Q122List employees who joined the company on the same date as another employee.
- Q123List employees whose Grade equals one-tenth of the Sales department's number.
- Q124List department names where more than the average number of employees work.
- Q125List the manager with the most employees reporting to them.
- Q136Count the characters in each name, not counting spaces.
- Q137Find employees whose salary has a decimal value โ without using LIKE.
Hint
Compare the salary to its own rounded-down value: ifsal <> TRUNC(sal), there's a fractional part. - Q138List employees whose salary starts with the same first four digits as their department number.
- Q146Check whether all employee numbers in the table are actually unique.
Hint
Group byempnoand look for any group withCOUNT(*) > 1โ if nothing comes back, they're all unique.
DECODE, CASE & Formatted Output
Turning raw columns into human-readable, conditional, or specially-formatted output โ column aliases, CASE/DECODE, and date formatting.
- Q126List Ename and salary increased by 15%, labeled in dollars.
- Q127Produce 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, viaAS. - Q128Reproduce 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. - Q130List 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. - Q131Label 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 forCASE WHEN ... THEN ... WHEN ... THEN ... ELSE ... END(orDECODEwith a comparison trick). - Q132Write a query that returns the day of the week for any date entered in 'DD-MM-YY' format.
- Q133Calculate each employee's length of service โ define a reusable expression so you're not retyping the date math every time.
- Q134Given 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_LIKEor similar) makes this a one-liner; without regex, check each character position withSUBSTR. - Q135Employees 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. - Q181List 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 ofsal, decide reasonable deduction rates for LIC/PF, and chain them into Gross โ Net.
Advanced Correlated Subqueries
Comparing employees to a named person (with their manager also shown), and to expressions defined once and reused.
- Q143Define a variable for "total annual remuneration" and use it to find everyone earning 30,000 a year or more.
- Q144Find out how many Managers there are in the company.
- Q145Find average salary and average total remuneration for each job type โ remember, salesmen also earn commission.
Hint
"Total remuneration" =sal + comm. Sincecommis NULL for non-salespeople, wrap it inCOALESCE(comm, 0)(orNVL) so the addition doesn't wipe out the whole row. - Q147List employees earning less than 1000, sorted by salary.
- Q148List employee name, job, annual salary, department number, department name, and grade for those who earn 36,000 a year, or who are not clerks.
- Q149Find which job was filled in the first half of 1983, and whether that same job was also filled in the same period of 1984.
- Q152Find everyone who earns the minimum salary for their job, sorted ascending.
- Q153Find 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 toMAX(sal)within aGROUP BY jobsubquery. - Q154Find the most recently hired employee in each department, sorted by hire date.
- Q155List employee name, salary, and department number for anyone earning more than their department's average, sorted by department.
- Q156List department numbers that have no employees at all.
- Q157List the employee count and average salary, broken down by department and job.
- Q158Find the highest average salary drawn for any job, excluding the President.
- Q159Find the name and job of whoever earns both the max salary and the max commission.
- Q160List name, job, and salary for employees outside department 10 who share the same job and salary as someone inside department 10.
Top-N & Ranking Queries
"Highest", "second-highest", "least" โ ranking-flavored questions that usually need a subquery rather than a simple ORDER BY + LIMIT.
- Q161List Deptno, Name, Job, Salary, and Sal+Comm for the salesman earning the highest combined salary and commission, descending.
- Q162List 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 ...). - Q163List department numbers and their average salary, for departments whose average is below the average across all departments.
- Q164List names and salaries of employees, alongside their manager's name and salary, for employees who out-earn their manager.
- Q165List name, job, and salary of employees in the department that has the highest average salary.
- Q235List the highest-paid employee in the company.
- Q236List the details of the most recently hired employee in department 30.
- Q237List the highest-paid employee in Chicago who joined before the most recently hired Grade 2 employee.
- Q238List the highest-paid employee reporting to KING.
Retrieval & Filtering, Revisited
- Q166List Empno, Sal, and Comm for every employee.
- Q167List employee details sorted by salary ascending.
- Q168List departments sorted by job ascending and employees descending; print Empno and Ename.
- Q169Display the unique departments employees belong to.
- Q170Display the unique department-and-job combinations.
- Q171Display BLAKE's details.
- Q172List all clerks.
- Q173List employees who joined on 1st May 1981.
- Q174List Empno, Ename, Sal, Deptno for department 10 employees, sorted by salary ascending.
- Q175List employees whose salary is less than 3500.
- Q176List Empno, Ename, Sal for employees who joined before 1 April 1981.
- Q177List employees whose annual salary is under 25,000, sorted ascending.
- Q178List Empno, Ename, annual salary, and daily salary for all salesmen, sorted by annual salary ascending.
- Q179List Empno, Ename, Hiredate, current date, and experience, sorted by experience ascending.
- Q180List employees with more than 10 years of experience.
Joins, Grades & Patterns, Revisited
- Q182List employees working as managers.
- Q183List employees who are either clerks or managers.
- Q184List employees hired on 1 May 81, 17 Nov 81, or 30 Dec 81.
- Q185List employees who joined in 1981.
- Q186List employees whose annual salary is between 23,000 and 40,000.
- Q187List employees reporting to managers 7369, 7890, 7654, or 7900.
- Q188List employees who joined in the second half of 1982.
- Q189List all employees with a 4-character name.
- Q190List employee names starting with 'M' with 5 characters.
- Q191List employees whose 5-character name ends with 'H'.
- Q192List names starting with 'M'.
- Q193List employees who joined in 1981.
- Q194List employees whose salary ends in "00".
- Q195List employees who joined in January.
- Q196List employees who joined in a month containing the letter 'a'.
- Q197List employees who joined in a month whose second letter is 'a'.
- Q198List employees whose salary is a 4-digit number.
- Q199List employees who joined in the 1980s.
- Q200List clerks with more than 8 years of experience.
- Q201List the managers of department 10 or 20.
- Q202List employees who joined in January with salary between 1500 and 4000.
- Q203List the unique jobs in departments 20 and 30, descending.
- Q209List the details of employees working at Chicago.
- Q210List Empno, Ename, Deptno, Loc for every employee.
- Q211List Empno, Ename, Loc, Dname for departments 10 and 20.
- Q212List Empno, Ename, Sal, Loc for employees at Chicago or Dallas with more than 6 years' experience.
- Q213List employees along with location, for those in Dallas or New York with salary 2000โ5000, who joined in 1981.
- Q214List Empno, Ename, Sal, Grade for every employee.
- Q215List the Grade 2 and 3 employees in Chicago.
- Q216List employees with location and grade, in Accounting, or in Dallas/Chicago with Grade 3โ5 and over 6 years' experience.
- Q217List the Grade 3 employees of Research and Operations who joined after 1987 and whose name isn't MILLER or ALLEN.
Comparisons & Self-Joins, Revisited
- Q218List employees whose job matches SMITH's.
- Q219List employees senior to MILLER.
- Q220List employees whose job matches ALLEN's, or whose salary beats ALLEN's.
- Q221List employees senior to their own manager.
- Q222List employees whose salary beats BLAKE's.
- Q223List department 10 employees whose salary beats ALLEN's.
- Q224List 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. - Q225List Empno, Ename, Loc, Sal, Dname for every employee in KING's department.
- Q226List employees whose salary grade beats MILLER's.
- Q227List employees in Dallas or Chicago whose grade matches ADAMS's, or whose experience beats SMITH's.
- Q228List employees whose salary matches FORD's or BLAKE's.
- Q229List employees whose salary matches any one of a given set of values.
- Q230Find any clerk's salary from an "emp1" table.
- Q231Find any employee from an "emp2" table who joined before 1982.
- Q232Find the total remuneration (salary + commission) of every salesperson in the Sales department, from an "emp3" table.
- Q233Find any Grade 4 employee's salary from an "emp4" table.
- Q234Find any employee's salary from an "emp5" table.
Challenge Queries
The last stretch of the sheet โ the most heavily stacked, multi-clause questions, saved for once everything above feels comfortable.
- Q204List employees with experience, working under a manager whose number starts with 7 but doesn't contain a 9, who joined before 1983.
- Q205List employees working as either Manager or Analyst, with salary 2000โ5000 and no commission.
- Q206List 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.
- Q207List 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.
- Q208List 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.