SQL Subqueries Quiz
24 Questions
0 Views

SQL Subqueries Quiz

Created by
@BraveChalcedony9426

Podcast Beta

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Display all the employees whose department names end with 'S'.

Query to display the employee names who have maximum salary in department name 'ACCOUNTING'.

Query to display the department name with the highest commission.

Query to display the employee names whose department name has the 2nd character as 'O'.

Signup and view all the answers

Query to display all the employees whose department number is the same as Scott.

Signup and view all the answers

Query to display all the employees in 'OPERATIONS AND ACCOUNTING' department.

Signup and view all the answers

List the employees who have a salary greater than Miller.

Signup and view all the answers

List the department names having at least 3 salesmen.

Signup and view all the answers

Display the department name of employees who have no reporting manager.

Signup and view all the answers

List all the employees who are reporting to Jones manager.

Signup and view all the answers

List employees from Research and Accounting having at least 2 reporting.

Signup and view all the answers

Display the department name of the employee who earns maximum salary and has no reporting manager.

Signup and view all the answers

Display the employee names, hire date, commission of Ford's manager.

Signup and view all the answers

Display the number of employees who are getting a salary less than Blake's manager.

Signup and view all the answers

List employees who are located in Chicago and their commission is zero.

Signup and view all the answers

List employees who work for the Sales department and their salary is greater than the average salary of their department.

Signup and view all the answers

List the employees who are working in the Research department and they are managers.

Signup and view all the answers

Display the location of the employee with the minimum salary who earns more than 2000.

Signup and view all the answers

Display the location of an employee in the Accounting department.

Signup and view all the answers

Display the department's location that has more than four employees.

Signup and view all the answers

Write a query to display all the employees whose job is not the same as Allen and salary is greater than Martin.

Signup and view all the answers

Display all the employees who are having locations the same as Adam's manager.

Signup and view all the answers

Display the job, manager number of employees who are working for Jones.

Signup and view all the answers

Display all the employees who have a salary greater than average salary of department 30.

Signup and view all the answers

Study Notes

Subquery Questions Overview

  • Queries involve complex conditions to filter employees based on various parameters.

Employee Identification by Department

  • Display employees in departments whose names end with 'S'.
  • Query employee names with maximum salary in the "ACCOUNTING" department.
  • Identify department names with the highest commission.
  • Show employee names where department names have 'O' as the 2nd character.
  • Find all employees with the same department number as the employee "SCOTT".

Salary Comparisons

  • List employees with a salary greater than that of "MILLER".
  • Query to find employees earning more than any "SALESMAN".
  • List employees earning more than the minimum salary greater than 2000.
  • Identify employees from "SALES" department earning more than average salary.
  • Display employees who get salaries lesser than any "SALESMAN".

Reporting Structure

  • List employees reporting to "JONES".
  • List employees with two reporting in "RESEARCH" and "ACCOUNTING".
  • Query departments with at least three salespeople.
  • List employees who do not report directly to the president.
  • Show employee details who report to "BLAKE" and have commission.

Hire Date and Job Analysis

  • Display employees who joined after the first employee of the company.
  • Identify employees hired between specific date ranges.
  • Show employee records of those hired before "BLAKE".

Location and Departmental Queries

  • List departments with at least one 'L' in their name.
  • Display locations of employees hired in the year '81.
  • Show the department of employees working in "NEW YORK".
  • Find departments with more than four employees.

Specific Role Analysis

  • Identify managers in specific departments.
  • Display department names for every employee whose job is "MANAGER".
  • List department details for employees earning the maximum commission.

General Queries

  • Display employee details with maximum commission and their annual salary.
  • List salaries that are maximum but less than a specified amount.
  • Identify the highest earning employees in their respective jobs.

Miscellaneous

  • Find the 3rd minimum salary within the employee table.
  • Analyze employees not taking commission who joined after a specified date.
  • Identify employees with the same reporting manager.
  • Show department-wise minimum salary which is less than the average salary.

Aggregate Functions

  • Display average salary of employees in the "ACCOUNTING" department.
  • Query showing maximum salary in the "SALES" department.
  • Identify the second maximum and third maximum salary.

Special Conditions

  • Filter employees based on specific salary criteria compared to others.
  • Display employees with specific job titles and their salary constraints.
  • Identify employees where the name or department starts with specific letters.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

sql subquery.pdf

Description

Test your knowledge of SQL subqueries with this set of questions. You'll tackle various scenarios involving employee departments and salary queries. Whether you are studying for a class or brushing up on your SQL skills, this quiz will challenge your understanding of subqueries.

More Like This

Use Quizgecko on...
Browser
Browser