You are on page 1of 3

create database BmsDB

use BmsDB

create table author_master

author_id int primary key,

author_firstname varchar(20),

author_lastname varchar(40),

author_dob date

create table customer_master

customer_id integer primary key,

customer_firstname varchar(20),

customer_middlename varchar(20),

customer_lastname varchar(20),

customer_phone_no integer,

customer_city varchar(20),

customer_email varchar(20),

customer_state varchar(20)

)
create table book_master

book_id integer primary key,

book_title varchar(20),

no_of_pages integer,

author_id integer,

book_cost integer,

book_subject varchar(20),

book_publication varchar(20),

book_public_date date,

constraint consfkaid foreign key(author_id) references author_master(author_id)

create table order_details

order_id integer primary key,

book_id integer,

quantity integer,

constraint consfkbid foreign key(book_id) references book_master(book_id)

create table order_customers_details

order_id integer,
delivery_date date,

customer_id integer,

order_date date,

delivery_status varchar(30),

constraint consfkcid foreign key(customer_id) references customer_master(customer_id),

constraint consfkoid foreign key(order_id) references order_details(order_id)

insert into author_master values(121,'Karthi','Kar','Sampath','1991-03-15');

insert into author_master values(122,'Karthi','Kar','Sampath','1991-03-15');

/*select the customer_name in that city select city who are having phone no 78289992 customer name
like R.Kowsalya*/

You might also like