Вы находитесь на странице: 1из 3

creating movies table:

create table movies


(movie_id varchar2(25) primary key,
movie_title varchar2(35) not null,
released_date date not null,
language varchar2(25) not null,
rating varchar2(5) not null,
genre varchar2(25)not null,
staring varchar2(50)not null,
director varchar2(25) not null,
description varchar2(500) not null,
runtime varchar2(20),
price number(5,2) not null,
status varchar2(20) default 'Available' not null)

creating video songs table


create table video_songs
(vs_id varchar2(25) primary key,
vs_title varchar2(35) not null,
released_date date not null,
language varchar2(25) not null,
rating varchar2(5) not null,
genre varchar2(25)not null,
staring varchar2(50)not null,
label varchar2(25) not null,
writer varchar2(25) not null,
length varchar2(20),
audio varchar2(25),
price number(5,2) not null,
status varchar2(20) default 'Available' not null)

creating audio songs table


create table audio_songs
(as_id varchar2(25) primary key,
as_title varchar2(35) not null,
released_date date not null,
language varchar2(25) not null,
rating varchar2(5) not null,
genre varchar2(25)not null,
singer varchar2(25) not null,
writer varchar2(25),
composer varchar2(50)not null,
label varchar2(25) not null,
audio varchar2(25),
price number(5,2) not null,
status varchar2(20) default 'Available' not null)

creating membership table:


create table members
(member_id varchar2(15) primary key,
member_name varchar2(35) not null,
member_address varchar2(35) not null,
membrshp_status varchar2(15) default 'N' not null ,
fine number(10) default 0)

creating transaction table


create table transaction
(tran_no varchar2(25) primary key,
product_id varchar2(35) not null,
member_id varchar2(15) notnull,
price number(5,2) not null,
isuue_date date default sysdate not null,
due_date date default sysdate+14 not null,
returned_date date not null,
fine number(5) default 0,
constraint tran_m_fk foreign key (product_id) references movies(movie_id),
constraint tran_v_fk foreign key (product_id) references video_songs(vs_id),
constraint tran_a_fk foreign key (product_id) references audio_songs(as_id),
constraint tran_mem_fk foreign key (member_id) references members(member_id));

create sequence mv_id start with 1001 increment by 1 nomaxvalue nocycle cache 5;
create sequence as_id increment by 1 nomaxvalue start with 1001 nocycle cache 5;
create sequence vs_id increment by 1 nomaxvalue start with 1001 nocycle cache 5;
create sequence mbr_id increment by 1 nomaxvalue start with 1001 nocycle cache 5
;
create sequence tran_id increment by 1 nomaxvalue start with 1001 nocycle cache
5;

insert into mem values ('mbr_'||mbr_id.nextval, initcap('&name'), initcap('&addr


ess'), initcap('&status'), default)
create synonym mvi for movies;
c/mvi/vds
create synonym vs for movies;
c/movies/video_songs
create synonym vs for video_songs;
c/vds/ads
create synonym ads for video_songs;
c/vide/audi
create synonym ads for audio_songs;
create synonym tran for transaction;
create synonym mem for members;

Вам также может понравиться