0% found this document useful (0 votes)
132 views2 pages

BCSE302 - DBMS Lab-Exercise 7 - SQL Set Operations and Views

This document describes an experiment involving SQL queries on customer, deposit, and loan tables to return data using various set operations and views. It includes: 1. Inserting sample data into the tables 2. Writing queries to return customer IDs for those with both/only deposits or loans 3. Creating views on the tables and testing insert/update/delete permissions

Uploaded by

aryan.sinha2021
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
132 views2 pages

BCSE302 - DBMS Lab-Exercise 7 - SQL Set Operations and Views

This document describes an experiment involving SQL queries on customer, deposit, and loan tables to return data using various set operations and views. It includes: 1. Inserting sample data into the tables 2. Writing queries to return customer IDs for those with both/only deposits or loans 3. Creating views on the tables and testing insert/update/delete permissions

Uploaded by

aryan.sinha2021
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

BCSE302 –DBMS

Experiment 7: Set Operations and View

Name: Akshat Raj


Reg No: 22bce1723

1. Consider the following relations/tables


Customer(Acno,Cid, Name, Address, DoB, MobileNo)
Deposit(Dno,Cid, Amount)
Loan(Lno,Cid, Amount)

Write SQL Query for the following,


1. Insert appropriate number of rows/tuples (at least 5 rows) in these
relations

2. Display CId of the customers those who have both deposit and loan
3. Display Cid of the customers those who have only deposit
4. Display Cid of the customers those who have only loan
5. Display Cid and Name of the customers those who have both deposit
and loan
6. Display Cid and Name of the customers those who have only deposit
7. Display Cid and Name of the customers those who have only loan

2. Write the SQL Query to create view


1. Create a view called Vname that consists of all the customer’s name
and account number
2. Create a view that consists of Cid and Name of the customers those who
have both deposit and loan
3. Create a view that consists of Cid and Name of the customers those who
have only deposit
4. Create a view that consists of Cid and Name of the customers those who
have only loan
5. Check insert/update/delete operations with Vname view
6. Delete the view Vname
7. Check insert/update/delete operations with the views created by using
set operations
8. Create a view using join operation
9. Check insert/update/delete operations with the views created by using
join operation
SQL> INSERT INTO Customer (Acno, Cid, Name, Address, DoB, MobileNo)
2 VALUES(1002, 'C102', 'Priya', 'Bangalore', TO_DATE('1975-07-14', 'YYYY-MM-DD'),
'8765432198');

1 row created.

SQL> INSERT INTO Customer (Acno, Cid, Name, Address, DoB, MobileNo)
2 VALUES(1003, 'C103', 'Mohan', 'Chennai', TO_DATE('1990-04-20', 'YYYY-MM-DD'),
'7896543211');

1 row created.

SQL> INSERT INTO Customer (Acno, Cid, Name, Address, DoB, MobileNo)
2 VALUES (1004, 'C104', 'Aisha', 'Delhi', TO_DATE('1985-11-23', 'YYYY-MM-DD'), '6543219876');

1 row created.

SQL> INSERT INTO Customer (Acno, Cid, Name, Address, DoB, MobileNo)
2 VALUES(1005, 'C105', 'David', 'West Bengal', TO_DATE('1968-12-31', 'YYYY-MM-DD'),
'9876541230');

1 row created.

You might also like