Compare commits

..

No commits in common. "e55e55e1e13244578bf59438d1fde558844fdfd0" and "35995f60e947fa1995760315c39a5f154ce36afb" have entirely different histories.

2 changed files with 7 additions and 10 deletions

View File

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