Compare commits

..

2 Commits

Author SHA1 Message Date
e55e55e1e1
added softcopy for assignment a3 2024-08-21 18:12:25 +05:30
b095079e38
fixed the queries in View3. 2024-08-21 18:11:54 +05:30
2 changed files with 10 additions and 7 deletions

View File

@ -127,20 +127,22 @@ FROM Borrower JOIN Depositor ON Borrower.cust_name = Depositor.cust_name;
SELECT * FROM View3;
-- Insert operation
// NEED TO FIX THIS
INSERT INTO Customer (cust_name, cust_street, cust_city) VALUES ("Sandy", "Pedgaon", "Ahemadnagar");
INSERT INTO Borrower (cust_name, loan_no) VALUES ("Sandy", 160);
INSERT INTO Depositor(cust_name, Acc_no) VALUES("Sandy", 2502);
INSERT INTO Customer (cust_name, cust_street, cust_city) VALUES ("Macho", "Pedgaon", "Ahemadnagar");
INSERT INTO Account (acc_no, branch_name, balance) VALUES (2502, "Hadapsar", 3000);
INSERT INTO Loan (loan_no, branch_name, amount) VALUES (160, "Hadapsar", 500);
INSERT INTO Borrower (cust_name, loan_no) VALUES ("Macho", 160);
INSERT INTO Depositor(cust_name, Acc_no) VALUES("Macho", 2502);
SELECT * FROM View3;
-- Update operation
UPDATE View3 SET acc_no = 102 WHERE cust_name = 'John_Doe';
INSERT INTO Account (acc_no, branch_name, balance) VALUES (2566, 'Hadapsar', 3000);
UPDATE Depositor SET acc_no = 2566 WHERE cust_name = 'Macho';
SELECT * FROM View3;
-- Delete operation
DELETE FROM View3 WHERE cust_name = 'John_Doe';
DELETE FROM Borrower WHERE cust_name = 'Macho';
DELETE FROM Depositor WHERE cust_name = 'Macho';
SELECT * FROM View3;
//
```
4. Create Union of left and right joint for all customers who have an account or loan or both at bank
@ -238,6 +240,7 @@ SELECT name, cost FROM Companies UNION SELECT domain, quantity FROM Orders;
5. Create View View1 by selecting both tables to show company name and quantities.
```sql
CREATE VIEW view1 AS SELECT name, quantity FROM Companies JOIN Orders ON Companies.comp_id = Orders.comp_id;
SELECT * FROM view1;
```

Binary file not shown.