0% found this document useful (0 votes)
12 views12 pages

Lab03 bscs22013 DB

The document provides examples of SQL queries on employee and department tables. It includes queries using operators like LIKE, IN, BETWEEN, AND and <> to filter records based on columns like name, salary, department, and hire date.

Uploaded by

bscs22013
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views12 pages

Lab03 bscs22013 DB

The document provides examples of SQL queries on employee and department tables. It includes queries using operators like LIKE, IN, BETWEEN, AND and <> to filter records based on columns like name, salary, department, and hire date.

Uploaded by

bscs22013
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Lab03_bscs22013_DB

0. Create the database and import the provided tables.

1. Get all employees whose first name starts with "A".(USE LIKE OPERATOR)

Rows Returned: 3
2. Select all unique values from the department_name column in the departments table.

Rows Returned: 5 Rows

3.List all employees with 'Salesperson' in their job titles, ordered by their hire dates:

Rows Returned: 5
4. Get all employees whose first name starts with "A" and last name contains "son":

Rows Returned: 1 row

5. List the employees whose department ID is either 1 or 2 and whose hire date is after
January 1, 2022.(USE IN OPERATOR)

Rows Returned: 7 IF date Strictly > than 1st Jan


6. Select the first_name and last_name columns for employees whose last name is
either "Johnson" or "Smith":.(USE IN OPERATOR)

Rows Returned: 7

7.List the employees whose first name starts with "J" or "M" and whose salary is
between $40,000 and $60,000. (USE LIKE OPERATOR)

Rows Returned: 6 rows


8. List all employees with salaries in descending order, then by hire date in ascending
order

Rows Returned: 20
9. List all employees with salaries in ascending order:

Rows Returned: 20 rows


10. Get all employees with a salary of $50,000 or $70,000, and whose first name starts
with "E".

Rows Returned: 1 row

11. Select all unique values from the department_name column in the departments table
where the department location is either 'New York' or 'London'.

Rows Returned: 2 rows


12. List all employees hired after January 1, 2022, in ascending order of their salaries:

Rows Returned: 18 rows


13. List the employees whose job title is either "Engineer" or "Manager" and whose
salary is greater than or equal to $60,000.

Rows Returned: 10 rows

14. Select the first_name, last_name, job_title, and salary columns from the employees
table where the job_title is either 'Engineer' or 'Manager' and the salary is greater than
or equal to $60,000

Rows Returned: 10 rows


15. List all employees with salaries in the range of $40,000 to $60,000, in ascending
order of their last names

Rows Returned: 10 rows

16. Get all employees with "Doe" in their last name.

Rows Returned: 2 rows


17. Select the first_name, last_name, job_title, and salary columns for employees who
are not Salespeople. (USE <> OPERATOR)

Rows Returned: 15 rows

18. Select the first_name, last_name, and job_title columns for employees who earn a
salary between $40,000 and $60,000.(USE ‘BETWEEN-AND’ OPERATOR)

Rows Returned: 10 rows


19.Get all Marketing Managers with a salary below $80,000 and hired before April 1st,
2022.(USE AND OPERATOR)

Rows Returned: 2 rows

20. Select the department_id, department_name, and location columns from the
departments table where the department_name is either 'Sales' or 'Marketing' and the
location is 'London'.

Rows Returned: 1 row

You might also like