0% found this document useful (0 votes)
8 views5 pages

Lab Quess

The document outlines various tasks related to SQL database management, including creating tables, altering structures, performing queries, and implementing triggers and procedures across multiple scenarios such as library, employee, college, and inventory databases. Each task is accompanied by a grading scheme that allocates points for aim, SQL queries, execution results, viva-voce, and record keeping. The document serves as a comprehensive guide for practical exercises in database management and SQL programming.

Uploaded by

shanthi
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)
8 views5 pages

Lab Quess

The document outlines various tasks related to SQL database management, including creating tables, altering structures, performing queries, and implementing triggers and procedures across multiple scenarios such as library, employee, college, and inventory databases. Each task is accompanied by a grading scheme that allocates points for aim, SQL queries, execution results, viva-voce, and record keeping. The document serves as a comprehensive guide for practical exercises in database management and SQL programming.

Uploaded by

shanthi
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/ 5

1.

Consider the following schema for a Library Database:


BOOK (Book_id, Title, Publisher_Name, Pub_Year, No_of_copies)
BOOK_AUTHORS (Book_id, Author_Name)
PUBLISHER (Name, Address, Phone)
a) Retrieve details of all books in the Book_id, title, name of publisher, authors
b) Get the particulars of borrowers who have borrowed more than 3 books, but from Jan 2017 to Jun2017.
c) Delete a book in BOOK table. Update the contents of other tables to reflect this data Manipulation
operations.
d) Create a view of all books and its number of copies that are currently available in the Library.
e) Write a Pl/SQL procedure to display the book details of particular author.

Aim and
SQL Query Execution and
Procedure / Viva-voce Record Total
and Program Results
E-R Diagram
20 30 30 10 10 100

2. Create a table employee (S.No,Name,Desination,brach),


a) Alter the table by adding a column salary
b) Copy the table employee as Emp
c) Delete 2 nd row from the table
d) Drop the table
e) Demonstrate the triggers for automatic updation.

Aim and
SQL Query Execution and
Procedure / Viva-voce Record Total
and Program Results
E-R Diagram
20 30 30 10 10 100

3. Create a table called Employee (Emp_no Emp_name, Emp_dept,Job ,Mgr ,Sal)


a) By using the group by clause, display the Emp_name who belongs to
Emp_dept=”xxx” along with salary
b) Display lowest paid employee details under each department
c) List the employee names in descending order.
d) Rename the column of Employee table using alter command
e) Insert row in employee table using Triggers.

Aim and
SQL Query Execution and
Procedure / Viva-voce Record Total
and Program Results
E-R Diagram
20 30 30 10 10 100
4. Consider the following tables namely “DEPARTMENTS” and “EMPLOYEES”
Departments (dept_no , dept_ name , dept_location ),
Employees ( emp_id , emp_name , emp_salary,dept_no).
a) Develop a query to grant some privileges of employees table into departments table
b) Develop a query to revoke all privileges of employees table from departments table
c) Develop a query to revoke some privileges of employees table from departments table
d) Write a query to implement the save point.
e) Demonstrate the user defined procedure for the above employee database
Aim and
SQL Query Execution and
Procedure / Viva-voce Record Total
and Program Results
E-R Diagram
20 30 30 10 10 100

5. Create the following tables,


Event (eventid, name, description,city)
Participant (playerid, name, eventid, gender, year)
Prizes (prizeid, prize-money, eventid, rank,year)
Winners (prizeid, playerid)
a) Choose appropriate primary keys and foreign keys for the tables.
b) Playerid should contain at least one digit character.
c) Retrieve the name of events where all prize winners are females
d) Create a non-updatable view to retrieve the names of all participants who won 1 st prizes along
with their event names
e) Write a trigger to make sure that for every new event created, 3 prizes are created in prizes table.
(1st prize - 1500, 2nd - 1000, 3rd 500)
Aim and
SQL Query Execution and
Procedure / Viva-voce Record Total
and Program Results
E-R Diagram
20 30 30 10 10 100

6. Consider the schema for Movie Database:


ACTOR (Act_id, Act_Name, Act_Gender)
DIRECTOR (Dir_id, Dir_Name, Dir_Phone)
MOVIES (Mov_id, Mov_Title, Mov_Year, Mov_Lang, Dir_id)
MOVIE_CAST (Act_id, Mov_id, Role)
a) List the titles of all movies directed by ‘XXXX’.
b) Find the movie names where one or more actors acted in two or more movies.
c) List all actors who acted in a movie before 2010 and also in a movie after 2015 (use JOIN
operation).
d) Create a view of movies with a particular actor with director.
e) Demonstrate the User defined function for the movie database.
Aim and
SQL Query Execution and
Procedure / Viva-voce Record Total
and Program Results
E-R Diagram
20 30 30 10 10 100
7. Consider the schema for College Database:
STUDENT (RegNo, StudName, Address, Phone, Gender)
SUBJECT (Subcode, Title, Sem, Credits)
MARKS (RegNo, Subcode, Test1, Test2, Test3, Finalmark)
a) Compute the total number of male and female students in each semester and in each section.
b) Calculate the Finalmark (average of best two test marks) and update the corresponding table for all
students.
c) Categorize students based on the following criterion:
If Finalmark = 81 to 100 then CAT = ‘Outstanding’
If Finalmark = 51 to 80 then CAT = ‘Average’
If Finalmark < 51 then CAT = ‘Weak
d) Create a view of Test3 marks of particular student in all subjects.
e) Demonstrate the procedure for the above Database.

Aim and
SQL Query Execution and
Procedure / Viva-voce Record Total
and Program Results
E-R Diagram
20 30 30 10 10 100

8. Create table as Bank ( S.No,Cust_Name, Acc_No, Balance, Branch),


a) Select with where clause.
b) Select with comparison operator.
c) Update the balance in the second row.
d) Select with between in the field balance.
e) Write a trigger when balance is below 1000.

Aim and
SQL Query Execution and
Procedure / Viva-voce Record Total
and Program Results
E-R Diagram
20 30 30 10 10 100

9. Create a table Account (Account_No, Cust_Name, Branch_Name, Account_Balance, Account_Type)


Select an appropriate primary key.
a) Display the Cust_Name and Account_No of the customers of "Branch = XXXXX".
b) Display the names and account types of all the customers whose account balance is more than 10,000.
c) Add column Cust_Date_of Birth in the ACCOUNT table.
d) Display Account_No, Cust_Name and Branch of all the customers whose account balance is less than
1,000.
e) Write a procedure for the above Database.

Aim and
SQL Query Execution and
Procedure / Viva-voce Record Total
and Program Results
E-R Diagram
20 30 30 10 10 100
10. Create the tables CUSTOMER (C_ID, Name, Address, City, Mobile_No) and
ORDER (C_ID, P_ID, P_Name, P_COST),
a) List the names and addresses of all the customers who have ordered products of cost more than 500.
b) List the names of all the products ordered whose cost is 1,000 or more.
c) List the product names which are ordered by customers of "City = Delhi".
d) Add column "Email_id" in the CUSTOMER table.
e) Demonstrate the user defined function for the above tables.

Aim and
SQL Query Execution and
Procedure / Viva-voce Record Total
and Program Results
E-R Diagram
20 30 30 10 10 100

11. Create the tables SALESMAN (Salesman_id, Name, City, Commission),


CUSTOMER (Customer_id, Cust_Name, City, Grade,Salesman_id),
ORDERS (Ord_No, Purchase_Amt, Ord_Date, Customer_id, Salesman_id)
a) Find the name and numbers of all salesmen who had more than one customer.
b) List all salesmen and indicate those who have and don’t have customers in their cities (Use UNION
operation.)
c) Create a view that finds the salesman who has the customer with the highest order of a day.
d) Perform the DELETE operation by removing salesman with id 1000. All his orders must also be deleted.
e) Demonstrate the Triggers for the above table.

Aim and
SQL Query Execution and
Procedure / Viva-voce Record Total
and Program Results
E-R Diagram
20 30 30 10 10 100

12. Develop a simple GUI based Inventory Management for a EMart Grocery Shop database application and
incorporate all the Database features.
Aim and
SQL Query Execution and
Procedure / Viva-voce Record Total
and Program Results
E-R Diagram
20 30 30 10 10 100

13. Create an XML database for the student profile and validate it using XML schema.

Aim and
SQL Query Execution and
Procedure / Viva-voce Record Total
and Program Results
E-R Diagram
20 30 30 10 10 100
15. Create a Employee database and write SQL Triggers for insert, delete, and update operations in a
database table.

Aim and
SQL Query Execution and
Procedure / Viva-voce Record Total
and Program Results
E-R Diagram
20 30 30 10 10 100

16. Create a table Supplier (Sup_No, Sup_Name ,Item_Supplied , Item_Price , City)


a) Write sql query to display Suplier numbers and Supplier names whose name starts with ‘S’
b) Write sql query to add a new column called CONTACTNO.
c) Write sql query to display supplier numbers, Suplier names and item price for suppliers in
Chennai in the ascending order of item price.
d) Create a view on the table which displays only supplier numbers and supplier names.
e) Demonstrate the procedure for the supplier table.

Aim and
SQL Query Execution and
Procedure / Viva-voce Record Total
and Program Results
E-R Diagram
20 30 30 10 10 100

18. Develop a simple GUI based Employee Pay Roll System and incorporate all the Database features.

Aim and
SQL Query Execution and
Procedure / Viva-voce Record Total
and Program Results
E-R Diagram
20 30 30 10 10 100

You might also like