sql2 lab 7/8(bank)
-- Create the Branch table
CREATE TABLE Branch (
br_name VARCHAR(20) PRIMARY KEY,
br_city VARCHAR(20),
assets NUMERIC(10)
);
-- Insert values into the Branch table
INSERT INTO Branch VALUES ('Baranagar', 'Kolkata', 80000);
INSERT INTO Branch VALUES ('Pawai', 'Mumbai', 10000);
INSERT INTO Branch VALUES ('Barrackpor', 'Kolkata', 20000);
-- Alter the Branch table to add a new column
ALTER TABLE Branch
ADD D_O_C DATE;
-- Update the D_O_C column for a specific branch
UPDATE Branch
SET D_O_C = '10-OCT-1956'
WHERE br_name = 'Pawai';
-- Drop the D_O_C column from the Branch table
ALTER TABLE Branch
DROP COLUMN D_O_C;
-- Delete a specific branch from the Branch table
DELETE FROM Branch
WHERE br_name = 'Pawai';
-- Select all records from the Branch table
SELECT * FROM Branch;
-- Create the Accounts table
CREATE TABLE Accounts (
ac_name VARCHAR(20) PRIMARY KEY,
br_name VARCHAR(20),
balance NUMERIC(10),
FOREIGN KEY (br_name) REFERENCES Branch(br_name)
);
-- Insert values into the Accounts table
INSERT INTO Accounts VALUES ('BR101', 'Baranagar', 100000);
-- Select all records from the Accounts table
SELECT * FROM Accounts;