DBMSLABQUESTIONS
DBMSLABQUESTIONS
Questions
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
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.
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.