1. Describe GRANT and REVOKE commands. |
2. Define 1) view. Write syntax to create a view .Give an example of view. 2) Primary key, Foreign Key and NOT NULL constraint 3) primary key, NOT NULL key and Unique key 4) DDL, DML and DCL. 5)Primary key, Candidate key and Super key. |
3. List and explain aggregation functions with suitable examples. |
4. Explain difference between strong entity set and weak entity set. |
5. Define View. Explain with appropriate examples. |
6. Consider following relations and write SQL queries for given statements. Assume suitable constraints. Instructor(ID, Name, Dept_name , Salary) Teaches(ID, Course_id, Sec_id, Semester(even/odd),Year) 1) Write SQL query to create Instructor table. 2) Find the average salary of the instructors in the computer department. 3) Find the number of instructors in each department who teach a course in the semester of 2016. 4) Find the names of instructors with salary amounts between 30000 and 50000. |
7. List and explain aggregation functions with suitable example. |
8. Compare rollback with commit SQL commands. |
9. Consider following the schema and write SQL for given statements. Client_master(clientno, name, address, city, pincode, state, baldue) Product_master(productno, name, profitpercent, unitmeasure, sellprice, costprice) Salesman_master(Salesmanno,name,address,city,pincode,state,salary,tgtotget, remarks) 07 1) Find out the names of all clients. 2) List all the clients who are located in Mumbai. 3) Delete all salesmen from salesman_master whose salaries are equal to Rs.3500. 4) Destroy the table client_master along with data. 5) List the name of all clients having ‘a’ as the second letter in their names. 6) Count the number of products having a cost price less than or equal to 500. 7) Calculate the average, minimum and maximum sell price of a product. |
10. Consider following the schema and write SQL for given statements. employee (employee-name, street, city) works (employee-name, company-name, salary) company (company-name, city) manages (employee-name, manager_name) 1. Find the names of all employees who work for First Bank Corporation. 2. Give all employees of First Bank Corporation a 10-percent raise. 3. Find the names and cities of residence of all employees who work for First Bank Corporation. 4. Find the names, street addresses, and cities of residence of all employees who work for First Bank Corporation and earn more than $10,000. 5. Find all employees in the database who live in the same cities as the companies for which they work. 6. Find all employees in the database who do not work for First Bank Corporation. |
11. Consider the following relations: EMP(empno, ename, jobtitle, managerno, hiredate, sal, commission, deptno) DEPT(deptno, dname, location) Answer the following queries in SQL and Give an expression in the relational algebra to express each of the following queries. a. Find the Employees working in the department number10, 20, 30 only. b. Find Employees whose names start with letter A or letter a. c. Find Employees along with their department name. d. Find the Employees who are working in Smith's department e. Find the Employees who get salary more than Allen’s salary. f. Display employees who are getting maximum salary in each department. g. Find list of employees whose hire date is on or before 1-April-18. |
12. Describe the following SQL functions: (i) Add_months(x,y) (ii) Rtrim() (iii) To_date. |
13. Explain commit, rollback and savepoint command. |
14. Write a PL/SQL block to print the given number is prime or not. |
15. Consider following the schema and write SQL for given statements. Student (RollNo, Name, DeptCode, City) Department (DeptCode, DeptName) Result (RollNo, Semester, SPI) 1. Display the name of students with RollNo whose name ends with ‘sh’. 2. Display department wise total students whose total students are greater than 500. 3. List out the RollNo, Name along with CPI of Student. 07 3 4. Create a RollNo field as the primary key for the existing Student table. 5. Display the student name who got the highest SPI in semester 1. 6. Display the list of students whose DeptCode is 5, 6,7,10. 7. Create table Student_New from student table without data. |
16. Consider the tables given below. Write the SQL queries for the questions given below: T1 ( Empno, Ename , Salary, Designation,) T2 (Empno, Deptno.) (1) Display all the details of the employee whose salary is lesser than 10000. (2) Display the Deptno in which Employees with names starting with letter ‘S’ are working. (3) Add a new column Deptname in table T2. (4) Change the designation of Geeta from ‘Manager’ to ‘Senior Manager’. (5) Find the total salary of all the employees department wise. (6) Add Empno as primary key in existing table T1. (7) Display the Deptno having the highest number of employees. |