fixed the queries in View3.
This commit is contained in:
parent
35995f60e9
commit
b095079e38
@ -127,20 +127,22 @@ FROM Borrower JOIN Depositor ON Borrower.cust_name = Depositor.cust_name;
|
|||||||
SELECT * FROM View3;
|
SELECT * FROM View3;
|
||||||
|
|
||||||
-- Insert operation
|
-- Insert operation
|
||||||
// NEED TO FIX THIS
|
INSERT INTO Customer (cust_name, cust_street, cust_city) VALUES ("Macho", "Pedgaon", "Ahemadnagar");
|
||||||
INSERT INTO Customer (cust_name, cust_street, cust_city) VALUES ("Sandy", "Pedgaon", "Ahemadnagar");
|
INSERT INTO Account (acc_no, branch_name, balance) VALUES (2502, "Hadapsar", 3000);
|
||||||
INSERT INTO Borrower (cust_name, loan_no) VALUES ("Sandy", 160);
|
INSERT INTO Loan (loan_no, branch_name, amount) VALUES (160, "Hadapsar", 500);
|
||||||
INSERT INTO Depositor(cust_name, Acc_no) VALUES("Sandy", 2502);
|
INSERT INTO Borrower (cust_name, loan_no) VALUES ("Macho", 160);
|
||||||
|
INSERT INTO Depositor(cust_name, Acc_no) VALUES("Macho", 2502);
|
||||||
SELECT * FROM View3;
|
SELECT * FROM View3;
|
||||||
|
|
||||||
-- Update operation
|
-- 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;
|
SELECT * FROM View3;
|
||||||
|
|
||||||
-- Delete operation
|
-- 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;
|
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
|
||||||
@ -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.
|
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;
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user