0% found this document useful (0 votes)
3 views3 pages

DBMSLABQUESTIONS

The document outlines the creation of four tables: Department, Employee, Customer, and Salgrade, with five values inserted into each. It includes various SQL queries for selecting, updating, deleting, and modifying data within these tables, as well as using aggregate functions and creating views. The queries cover a range of operations such as filtering by department, updating salaries, and managing table structures.

Uploaded by

ahanasayeed.786
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)
3 views3 pages

DBMSLABQUESTIONS

The document outlines the creation of four tables: Department, Employee, Customer, and Salgrade, with five values inserted into each. It includes various SQL queries for selecting, updating, deleting, and modifying data within these tables, as well as using aggregate functions and creating views. The queries cover a range of operations such as filtering by department, updating salaries, and managing table structures.

Uploaded by

ahanasayeed.786
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/ 3

Create all the 4 tables 1) Department 2)Employee 3)Customer and 4) Salgrade

and Insert 5 values TO Each Table based on the requirement.

Questions

1)Working with Table and data using another Table.

a) Query 1: Select employee with EMP_ID = 1003

b) Query 2: Show all the employees who are in department number 3.

c) Query 3: Write an SQL query to update the salary to 18,000 for the employee whose
EMP_ID is 1004.

d) Query 4: Write an SQL query to display the employee id (EMP_ID) and salary (SAL) of
the employee whose EMP_ID is 1004.

e) Query 5: Write an SQL query to display the Employee ID, First Name, Last Name, and
Department Name of employees who are department managers.

f) Query 6: Write an SQL query to Delete the record whose EMP_ID is 1003

2) Modifying Table Structure and updating data.

a) Query 1: Write an SQL Query to Rename the JOB_ID column to DESG in the EMP table

b) Query 2: Write an SQL Query to Add a new column ADDR to the EMP table.

c) Query 3: Write an SQL Query to Drop the ADDR column from the EMP table.

d) Query 4: Write an SQL Query to Modify the ADDR column in the CUST table to
VARCHAR2(50).

e) Query 5: Update the HIGH_SAL in the SALGRADE table for GRADE = 'GRADE-1'.
5) Using WHERE clause (matching characters and NULL values)

a) Query 1: Write an SQL query to display all employee details where the last name
contains the word 'SHARMA'.

b) Query 2: Write an SQL query to display all employee details where the date of joining
(DOJ) contains the month 'JAN'.

c) Query 3: Write an SQL query to update the last name (LNAME) to an empty value for
the employee whose EMP_ID is 1004.

d) Query 4: Write an SQL query to display all employee details where the last name
(LNAME) is NULL.

e) Query 5: Write an SQL query to display all employee details where the last name
(LNAME) is not NULL.

10) Aggregate functions.

a) Query1: Write an SQL query to display the department ID and the number
of employees in each department.
b) Query2: Write an SQL query to update the department ID to 3 for
employees with IDs 1001 and 1004.
c) Query3: Write an SQL query to update the department ID to 4 for
employees with IDs 1002 and 1005.
d) Query4: Write an SQL query to display all records from the EMP table.
e) Query5: Write an SQL query to display the department ID, number of
employees, and average salary for departments having at least 2
employees.
f) Query6: Write an SQL query to display the department ID, number of
employees, and average salary for each department.
g) Query 7: Write an SQL query to display the department ID, number of
employees, minimum salary, and maximum salary for each department.
h) Query 8: Write an SQL query to calculate the total salary of all employees.
13) Creating and Working with Views.

a) Query 1: Create a view named CVR to display EMP_ID, FNAME, LNAME, and
SAL columns from the EMP table.
b) Query 2: Display all the records from the view CVR.
c) Query 3: Display the employees from the view CVR whose salary is greater
than or equal to 22000.
d) Query 4: Describe the structure of the view CVR.s
e) Query 5: Drop (delete) the view CVR from the database.

You might also like