BANK

an anonymous user · June 24, 2022
CREATE TABLE BANK(CUSTOMER INT PRIMARY KEY ,
NAME VARCHAR(20),
BRANCH VARCHAR(20),
CITY VARCHAR(20),
DEPOSIT INT,LOAN INT);
INSERT INTO BANK VALUES(1,"harshal","GOTRI","VADODARA",1000000,50000);
INSERT INTO BANK VALUES(2,"dhanraj","GOTRI","VADODARA",2000000,600000);
INSERT INTO BANK VALUES(3,"mahek","PUNE","MUMBAI",5000000,100000);
INSERT INTO BANK VALUES(4,"kushi","PUNE","MUMBAI",400000,10000);
INSERT INTO BANK VALUES(5,"bhavik","PUNE","MUMBAI-WEST",6000000,20000);

SELECT SUM(DEPOSIT) "TOTAL DEPOSIT TAKEN FROM BRANCH KAROLBAGH" FROM BANK  WHERE BRANCH ="GOTRI";
SELECT MAX(LOAN) "TOTAL DEPOSIT TAKEN FROM BRANCH VERCE" FROM BANK WHERE BRANCH='PUNE';

SELECT COUNT(CUSTOMER) "TOTAL CUSTOMER: " FROM BANK;
SELECT COUNT(CITY) "TOTAL CUSTOMER CITIES: " FROM BANK;
CREATE TABLE SUP1 AS SELECT CUSTOMER, BRANCH, CITY, DEPOSIT FROM BANK;
SELECT * FROM SUP1;

CREATE TABLE SUP3 AS SELECT CUSTOMER , NAME ,BRANCH , CITY,DEPOSIT FROM BANK WHERE NAME LIKE "_n___";
SELECT * FROM SUP3;

DROP TABLE SUP1;

DELETE FROM BANK WHERE CUSTOMER = 3;
SELECT * FROM BANK;

UPDATE BANK
SET CUSTOMER = 10
WHERE NAME = "mahek";
SELECT * FROM BANK; 

UPDATE BANK
SET NAME = "dhanraj"
WHERE CUSTOMER = 1;
SELECT * FROM BANK;
Output
(Run the program to view its output)

Comments

Please sign up or log in to contribute to the discussion.