--***********************drop tables*************************************
DROP TABLE customer CASCADE CONSTRAINTS ;
DROP TABLE account CASCADE CONSTRAINTS ;
DROP TABLE owner ;
DROP TABLE branch CASCADE CONSTRAINTS ;
DROP TABLE employee ;
--**********************creating tables**********************************
CREATE TABLE customer
(
CUSTID number(10) ,
FORENAME char(15) ,
SURNAME char(15) ,
ADDRESS varchar2(60) ,
OCCUPATION varchar2(20) ,
CONSTRAINT customer_custid_pk PRIMARY KEY(custid)
);
CREATE TABLE account
(
ACCOUNTNO number(10) ,
TYPE char(15) ,
BALANCE number(10) ,
INBRANCH varchar2(15) ,
CONSTRAINT account_accountno_pk PRIMARY KEY(accountno)
);
CREATE TABLE owner
(
ACCOUNTNO number(10) ,
CUSTID number(10) ,
CONSTRAINT owner_accno_custid_cpk PRIMARY KEY(accountno, custid) ,
CONSTRAINT owner_accno_fk FOREIGN KEY(accountno) REFERENCES account(accountno) ,
CONSTRAINT owner_custid_fk FOREIGN KEY(custid) REFERENCES customer(custid)
);
CREATE TABLE branch
(
BRANCHNO number(5) ,
BRADDRESS varchar2(60) ,
CONSTRAINT branch_branchno_pk PRIMARY KEY(branchno)
);
CREATE TABLE employee
(
STAFFNO number(5) ,
FORENAME char(15) ,
SURNAME char(15) ,
BRANCHNO number(10) ,
SUPERVISOR varchar2(30) ,
CONSTRAINT employee_staffno_pk PRIMARY KEY(staffno) ,
CONSTRAINT employee_branchno_fk FOREIGN KEY(branchno) REFERENCES branch (branchno)
);
--***********************inserting values****************************
INSERT INTO customer (custid, forename, surname, address, occupation)
VALUES ( , ' ', ' ', ' ', ' ') ;
INSERT INTO customer (custid, forename, surname, address, occupation)
VALUES ( , ' ', ' ', ' ', ' ') ;
INSERT INTO customer (custid, forename, surname, address, occupation)
VALUES ( , ' ', ' ', ' ', ' ') ;
INSERT INTO customer (custid, forename, surname, address, occupation)
VALUES ( , ' ', ' ', ' ', ' ') ;
INSERT INTO customer (custid, forename, surname, address, occupation)
VALUES ( , ' ', ' ', ' ', ' ') ;
INSERT INTO account (accountno, type, balance, inbranch)
VALUES ( , ' ', , ) ;
INSERT INTO account (accountno, type, balance, inbranch)
VALUES ( , ' ', , ) ;
INSERT INTO account (accountno, type, balance, inbranch)
VALUES ( , ' ', , ) ;
INSERT INTO account (accountno, type, balance, inbranch)
VALUES ( , ' ', , ) ;
INSERT INTO account (accountno, type, balance, inbranch)
VALUES ( , ' ', , ) ;
INSERT INTO owner (accountno, custid)
VALUES ( , ) ;
INSERT INTO owner (accountno, custid)
VALUES ( , ) ;
INSERT INTO owner (accountno, custid)
VALUES ( , ) ;
INSERT INTO owner (accountno, custid)
VALUES ( , ) ;
INSERT INTO owner (accountno, custid)
VALUES ( , ) ;
INSERT INTO branch (branchno, braddress)
VALUES ( , ' ') ;
INSERT INTO branch (branchno, braddress)
VALUES ( , ' ') ;
INSERT INTO branch (branchno, braddress)
VALUES ( , ' ') ;
INSERT INTO branch (branchno, braddress)
VALUES ( , ' ') ;
INSERT INTO branch (branchno, braddress)
VALUES ( , ' ') ;
INSERT INTO employee (staffno, forename, surname, branchno, supervisor)
VALUES ( , ' ', ' ', , ' ') ;
INSERT INTO employee (staffno, forename, surname, branchno, supervisor)
VALUES ( , ' ', ' ', , ' ') ;
INSERT INTO employee (staffno, forename, surname, branchno, supervisor)
VALUES ( , ' ', ' ', , ' ') ;
INSERT INTO employee (staffno, forename, surname, branchno, supervisor)
VALUES ( , ' ', ' ', , ' ') ;
INSERT INTO employee (staffno, forename, surname, branchno, supervisor)
VALUES ( , ' ', ' ', , ' ') ;