DBMS practical

mail@pastecode.io avatar
unknown
sql
a year ago
3.0 kB
5
Indexable
create table branch(
branchName varchar(100) primary key,
branchCity varchar(100),
assets varchar(100));
create table account(
accountNumber varchar(100) primary key,
branchName varchar(100),
balance varchar(100));
create table customer(
customerName varchar(100) primary key,
customerStreet varchar(100),
customerCity varchar(100));
create table loan(
loanNumber varchar(100) primary key,
branchName varchar(100),
amount varchar(100));
create table depositor(
customerName varchar(100),
accountNumber varchar(100),
primary key(customerName, accountNumber));
create table borrower(
customerName varchar(100),
loanNumber varchar(100),
primary key(customerName, loanNumber));
alter table account add foreign key (branchName) references branch(branchName);
alter table depositor add foreign key (accountNumber) references account
     (accountNumber);
alter table depositor add foreign key (customerName) references customer
     (customerName);
alter table borrower add foreign key (customerName) references customer
     (customerName);
alter table borrower add foreign key (loanNumber) references loan(loanNumber);
alter table loan add foreign key (branchName) references branch(branchName);
INSERT INTO branch
VALUES ('Brighton', 'Brooklyn', '7100000'),
('Downtown', 'Brooklyn', '9000000'),
('Mianus', 'Horseneck', '400000'),
('North Town', 'Rye', '3700000'),
('Perryridge','Horseneck','1700000'),
('Pownal','Bennington','300000'),
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX