Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ===== CREATE query Account master TABLE
- CREATE TABLE account_master
- (
- act_no INTEGER PRIMARY KEY,
- custname VARCHAR(20),
- address VARCHAR(20),
- act_type VARCHAR(10),
- open_date DATE,
- balance INTEGER,
- CONSTRAINT chk_type CHECK (act_type IN ('saving','current'))
- );
- CREATE TABLE accont_transaction
- (
- trans_id INTEGER PRIMARY KEY,
- trans_type VARCHAR(15),
- trans_date DATE,
- act_no INTEGER,
- trans_amt INTEGER,
- CONSTRAINT check_ttype CHECK (trans_type IN ('deposite','withdrawal')), CONSTRAINT
- fk_act_no FOREIGN KEY (act_no) REFERENCES account_master (act_no) ON UPDATE cascade ON DELETE cascade
- );
- INSERT QUERY.
- INSERT INTO account_master VALUES(100,'jay','bhatar','saving','2017-05-04','20000');
- INSERT INTO account_master VALUES(101,'gutam','pipload','current','2013-01-02','34000');
- INSERT INTO account_master VALUES(102,'devyesh','udhna','current','2014-12-04','27000');
- INSERT INTO account_master VALUES(103,'jenish','adajan','saving','2016-05-04','40000');
- INSERT INTO account_master VALUES(104,'krushang','vesu','current','2015-01-04','8000');
- INSERT INTO account_master VALUES(105,'carry','farukhabad','current','1905-01-04','23000');
- INSERT INTO account_master VALUES(106,'bhuvan','delhi','current','2015-01-04','2000');
- INSERT INTO accont_transaction VALUES(1003,'withdrawal','2020-02-01','100','2000');
- INSERT INTO accont_transaction VALUES(1004,'withdrawal','2020-02-15','101','4000');
- INSERT INTO accont_transaction VALUES(1005,'deposite','2020-02-23','102','2500');
- INSERT INTO accont_transaction VALUES(1006,'withdrawal','2020-03-01','103','1800');
- INSERT INTO accont_transaction VALUES(1007,'deposite','2020-03-05','104','6000');
- INSERT INTO accont_transaction VALUES(1008,'deposite','2019-12-05','105','2000');
- INSERT INTO accont_transaction VALUES(1009,'withdrawal','2020-03-05','101','2000');
- INSERT INTO accont_transaction VALUES(1010,'deposite','2020-03-02','103','1800');
- INSERT INTO accont_transaction VALUES(1011,'withdrawal','2014-12-02','105','1800');
- INSERT INTO accont_transaction VALUES(1012,'deposite','2018-10-23','100','8000');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement