DBMS QB
DBMS QB
MODULE-1
MODULE-2
4) List all Employees names and Department Names they work for
5) List all pairs of Employees names and Project names they work on
6)Write relational algebraiTo retrieve the social security numbers of all employees who either work in
department 5 or directly supervise an employee who works in department 5
7)
8)
6) Consider the following schema and write the queries using SQL
EMPLOYEE(Name, SSN, Address, Sex, Salary, SupervisorNum, Dno )
DEPARTMENT(Dname, Dnumber, MgrSSN, Mgr_Startdate)
DEPENDENT(ESSN,Dependent_name,Sex,Bdate,Relationship)
i) Find all the employees working for the department “Research”
SELECT NAME FROM EMPLOYEE, DEPARTMENT
WHERE DNo=DNos AND DName=’Research’;
ii) Write a query in SQL to display all the unique job in descending order.
SELECT DISTINCT job_name
FROM employees ORDER BY job_name DESC;
iii) List the names of employees who superwise themselves
SELECT NAME FROM EMPLOYEE
WHERE SuperSSN is NULL;
iv) List all employees who earn more than their managers
SELECT E1.Name FROM EMPLOYEE E1, EMPLOYEE E2
WHERE E1.SuperSSN=E2.SSN AND E1.Salary>E2.Salary;
v) Write a query in SQL to list the employees who are senior to their own MANAGERS
SELECT E1.Name FROM EMPLOYEE E1, EMPLOYEE E2
WHERE E1.SuperSSN=E2.SSN AND E1.hire_date>E2. hire_Date;
7) Write the SQL Queries for the given schema:
Student (Name, student-number. class, major)
Course (Course name, Course Number, Credit hours, Department)
Section (Section identifier. Course number. Semester, Year, Instructor)
Grade-report (Student Number, Section Identifier, Grade)
Pre-requisite (Course number, Pre requisite Number)
i. Change the class of student 'Uday' to 2.
ii. Delete the record for the student whose name is 'GEETA' and whose student
number is 17.
iii. For each Section taught by Prof. Jain retrieve the course number, Semester,
Year and number of students who took the section.
iv. Retrieve the names of all senior student majoring in 'CS'.
v. Insert a new course, < 'neural networks, 'CS4390', 3, 'CS')
8) Consider the following schema and write the queries using SQL (10)
STUDENT(Student_Id, Sname, Major, GPA)
FACULTY(Faculty_Id, Fname, Dept, Designation, Salary)
COURSE(Course_Id, Cname, Faculty_Id)
ENROLL(Course_Id, Student_Id, Grade)
i) List the names of all students enrolled for the course “CS54”
ii) List the names of students enrolled for the course “CS54” and have received ‘A’ Grade
iii) List all the departments having an average salary of Rs 20000/-
iv) Give a 15% raise to salary of all faculties.
v) List the names of all faculty members begining with “R” and ending with letter “U”
9) Explain the following specified SQL Clauses with example WHERE clause , ORDER BY, GROUP
BY, HAVING
10) Explain the different DDL commands with examples.
11) Explain the different DML commands with examples.
12) Explain the uses of ALTER command with examples.
13) Explain with an example self-referential integrity.
14) Explain the uses of the following SQL commands a) GRANT b)REVOKE c)ROLLBACK d)COMMIT
MODULE-3
1. What is view in SQL and how it is define? How views are implemented?
2. Explain correlated queries with an example.
3. Write a correlated query to retrieve the names and Ids of employees whose salary is greater than
the average salary of the department
MODULE-4
MODULE-5