2. Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .
Ltd
4. DATABASE
• A Database is a Structured collection of data.
• It acts as a container for related tables.
For eg. It could hold all your customer and order
information.
• To create database
Eg: Createdb Mydb;
5. PROBLEM STATEMENT
• Design a database for a travelling agency to
track its customers and their booking. It can
have maximum two tables.
6. 1.Tbl_customer
Fields Datatype
Vchr_Customer_name varchar(20)
pk_bint_Client_id Big int
vchr_email_id Varchar(20)
bln_gender Boolean
bint_cust_phone Bigint
7. 2.Tbl_booking
Fields Datatype
pk_ticket_no integer
vchr_Source varchar(20)
vchr_Destination varchar(20)
dat_Date_of_jrny date
dat_Date_of_Bookg date
fk_bint_Client_id bigint
9. INSERTING IN TABLE
• To insert values into a table:
• INSERT INTO table_name
VALUES(value1 , value2 , value3 , …);
INSERT INTO tbl_Client_details
VALUES(2,'B','b@gmail.com',55,'0',977788822);
10. SELECT COMMAND
• To view contents of a table:
• SELECT * FROM table_name;
Select * from tbl_Client_details.
Displays all the contents in the table tbl_Client_details.
11. DECLARING PRIMARY & FOREIGN
KEYS
• To declare primary key:
Create Table table_1
( primary int PRIMARY KEY,
column2 data_type,….
);
• To declare foreign key:
Create Table table_2
( foreign int REFERENCES table_1(primary)
column2 data_type,….
);
12. If this presentation helped you, please visit our
page facebook.com/baabtra and like it.
Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com