Sunteți pe pagina 1din 10

Online Book Store

(Documentation of Database Tables)

[Note: The queries for creating tables should be executed as per the sequence
of documentation.]
Customers Table:

Column Column Name Data Type Size Constraint Null/Not


Null
Customer Id c_id number Primary key not null
Customer’s First c_fname nvarchar2 30 not null
Name
Customer’s Last c_lname nvarchar2 30 not null
Name
Customer’s c_dob date not null
Date of Birth
Customer’s Email c_emailid nvarchar2 50 unique not null
Address
Customer’s Contact c_contact number 15 unique not null
Number
Customer’s Country c_countrycode nvarchar2 5 not null
Code
Customer’s Address c_address1 nvarchar2 50 not null
Line One
Customer’s Address c_address2 nvarchar2 50 not null
Line Two
Customer’s State of c_state nvarchar2 20 not null
Residence
Customer’s City of c_city nvarchar2 25 not null
Residence
Customer’s Postal c_pincode number 10 not null
Area Code
Customer’s User c_username nvarchar2 15 unique not null
Name
Customer’s c_password nvarchar2 20 not null
Password
Customer’s c_wallet number not null
E- Wallet Balance
Customer’s Account c_status nvarchar2 8 not null
Status
Query for creating customers table:

create table customers(c_id number primary key,c_fname nvarchar2(30) not null,c_lname nvarchar2(30)
not null,c_dob date not null,c_emailid nvarchar2(50) unique not null,c_contact number(15) unique not
null,c_countrycode nvarchar2(5) not null,c_address1 nvarchar2(50) not null,c_address2 nvarchar2(50)
not null,c_state nvarchar2(20) not null,c_city nvarchar2(25) not null,c_pincode number(10) not
null,c_username nvarchar2(15) unique not null,c_password nvarchar2(20) not null,c_wallet number not
null,c_status nvarchar2(10) not null);
Admin Table:

Column Column Name Data Type Size Constraint Null/Not


Null
Admin Id a_id number Primary key not null
Admin’s First Name a_fname nvarchar2 30 not null
Admin’s Last Name a_lname nvarchar2 30 not null
Admin’s a_dob date not null
Date of Birth
Admin’s a_emailid nvarchar2 50 unique not null
Email Address
Admin’s a_contact number 15 unique not null
Contact Number
Admin’s a_countrycode nvarchar2 5 not null
Country Code
Admin’s a_address1 nvarchar2 50 not null
Address Line One
Admin’s a_address2 nvarchar2 50 not null
Address Line Two
Admin’s a_state nvarchar2 20 not null
State of Residence
Admin’s a_city nvarchar2 25 not null
City of Residence
Admin’s a_pincode number 10 not null
Postal Area Code
Admin’s a_username nvarchar2 15 unique not null
User Name
Admin’s a_password nvarchar2 20 not null
Password

Query for creating Admin Table:

create table admin(a_id number primary key,a_fname nvarchar2(30) not null,a_lname nvarchar2(30)
not null,a_dob date not null,a_emailid nvarchar2(50) unique not null,a_contact number(15) unique not
null,a_countrycode nvarchar2(5) not null,a_address1 nvarchar2(50) not null,a_address2 nvarchar2(50)
not null,a_state nvarchar2(20) not null,a_city nvarchar2(25) not null,a_pincode number(10) not
null,a_username nvarchar2(15) unique not null,a_password nvarchar2(20) not null);
Author_Details Table:

Column Column Name Data Type Size Constraint Null/Not


Null
Author Id au_id nnumber not null
Author ‘s First Name au_fname nvarchar2 30 not null
Author’s Last Name au_lname nvarchar2 30 not null
Author’s Date of au_dob date not Null
Birth
Author’s Email Id au_emailid nvarchar2 50 unique not null
Author’s Contact au_contactnum number 15 unique not Null
Number ber
Author’s Country au_countrycode nvarchar2 5 not null
Code
Author’s State of au_state nvarcahr2 20 not null
Residence
Author’s City of au_city nvarchar2 25 not null
Residence
Author’s au_description nvarchar2 1000 not null
Description
Author’s Image au_image blob not null

Query for creating Author_Details table:

create table author_details(au_id number primary key,au_fname nvarchar2(30) not null,au_lname


nvarchar2(30) not null,au_dob date not null,au_emailid nvarchar2(50) unique not null,au_contact
number(15) unique not null,au_countrycode nvarchar2(5) not null, au_state nvarchar2(20) not
null,au_city nvarchar2(25) not null,au_description nvarchar2(1000) not null,au_image blob not null);
Publisher Table:

Column Column Name Data Type Size Constraint Null/Not


Null
Publisher Id p_id number Primary key
Publisher’s Name p_name nvarchar2 50 Unique not null
Publisher’s Email Id p_email nvarchar2 50 unique not null
Publisher’s Contact p_contact number 15 unique not null
Number
Publisher’s Country p_countrycode nvarchar2 50 not null
Code
Publisher’s Address p_address1 nvarchar2 50 not null
Line One
Publisher’s Address p_address2 nvarchar2 50 not null
Line Two
Publisher’s State p_state nvarchar2 20 not null
Publisher’s City p_city nvarchar2 25 not null
Publisher’s Postal p_pincode number 10 not null
Area Code

Query for creating publishers table:

Create table pubishers(p_id number primary key,p_name nvarchar2(50) not null unique,p_email
nvarchar2(50) unique not null,p_contact number(15) unique not null,p_country code nvarchar2(50) not
null,p_address1 nvarchar2(50) not null,p_address2 nvarchar2(50) not null,p_state nvarchar2(20) not
null,p_city nvarchar2(25) not null,p_pincode number(10) not null);
Category Table:

Column Column Name Data Type Size Constraint Null/Not


Null
Category Id c_id number primary key
Category Name c_name nvarchar2 20 unique not null

Query for creating Category table:

Create table category(c_id number primary key,c_name nvarchar2(20) unique not null);
Book_Details Table:

Column Column Name Data Type Size Constraint Null/Not


Null
Book Id b_id number Primary key not null
Book ISBN Number b_isbn number unique not null
Book Name b_name nvarchar2 40 not null
First Author’s Id author1_id number Foreign key references not null
author_details table au_id
column
Second Author’s Id author2_id number Foreign key references null
author_details table au_id
column
Third Author’s Id author 3_id number Foreign key references null
author_details table au_id
column
Category ID category_id number Foreign key references not null
category table c_id column
Book Price b_price number 8 not null
Book Rating b_rating number 1 not null
(0-9)
Book Edition b_edition nvarchar2 15 not null
Publisher’s Id publisher_id number Foreign key references not null
publisher table p_id
column
Book Cover Page b_coverpage blob not Null
Book Description b_description nvarchar2 1000 not null
Book Type b_type nvarchar2 15 not null
Number of Pages of b_no_of_pages number not null
Book
Book Language b_language nvarcahr2 20 not null

Query for creating Book_Details table:

create table book_details(b_id number primary key,b_isbn number unique not null,b_name
nvarchar2(40) not null,author1_id number references author_details(au_id) not null,author2_id number
references author_details(au_id) null,author3_id number references author_details(au_id)
null,category_id number references category(c_id) not null,b_price number(8) not null,b_rating
number(1) not null,b_edition nvarchar2(15) not null,publisher_id number references publisher(p_id) not
null,b_coverpage blob not null,b_description nvarchar2(1000) not null,b_type nvarchar2(15) not
null,b_no_of_pages number not null,b_language nvarchar2(20) not null);
Order_Details Table:

Column Column Name Data Type Size Constraint Null/Not


Null
Order Id o_id number Primary Key
Book Id book_id number Foreign Key references to not null
book_details table b_id
column
Order Quantity o_quantity number not null
Customer Id customer_id number Foreign Key references to not null
Customers table c_id
column
Order Date o_date date not null
Order Status o_status nvarchar2 15 not null

Query for creating order_details table:

Create table order_details(o_id number primary key,book_id number references book_details(b_id) not
null,o_quantity number not null,customer_id number references customers(c_id) not null,o_date date
not null,o_status nvarchar2(15) not null);
Replacement Table:

Column Column Name Data Type Size Constraint Null/Not


Null
Replacement Id r_id number Primary key
Order Id order_id number Foreign Key references to not null
order_Details table o_id
column
Replacement r_reason nvarchar2 150 not null
Reason
Replacement Status r_status nvarchar2 15 not null

Query for creating replacement table:

Create table replacement_details(r_id number primary key,order_id number references


order_details(o_id) not null,r_reason nvarchar2(150) not null,r_status nvarchar2(15) not null);
Feedback Table:

Column Column Name Data Type Size Constraint Null/Not


Null
Feedback ID f_id number primary key
Customer Id customer_id number foreign key references not null
customers table c_id
column
Book Id book_id number foreign Key references not null
book_details table b_id
column
Feedback f_feedback nvarchar2 500 not null

Query for creating feedback table:

Create table feedback_details(f_id number primary key,customer_id number references


customers(c_id) not null,book_id number references book_details(b_id) not null,f_feedback
nvarchar2(500) not null);

S-ar putea să vă placă și