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
DATABASE DESIGNING


       Reshmi
       reshmi@ymail.com
       www.facebook.com/reshmi.
         ramaswami
       twitter.com/username
       in.linkedin.com/in/profilena
         me
       Phonenumber
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;
PROBLEM STATEMENT

• Design a database for a travelling agency to
  track its customers and their booking. It can
  have maximum two tables.
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
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
CREATE TABLE
• To create a new table:

• CREATE TABLE table_name
           (
           column_name1 data_type,
           column_name2 data_type,
           …
           );
 Create table tbl_Client_details(pk_bint_Client_id bigint PRIMARY
  KEY,vchr_Client_name varchar(50),vchr_email_id
  varchar(50),bln_gender boolean,bint_phone_num bigint);
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);
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.
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,….
  );
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
Contact Us

Database design

  • 2.
    Disclaimer: This presentationis 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
  • 3.
    DATABASE DESIGNING Reshmi reshmi@ymail.com www.facebook.com/reshmi. ramaswami twitter.com/username in.linkedin.com/in/profilena me Phonenumber
  • 4.
    DATABASE • A Databaseis 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 • Designa 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
  • 8.
    CREATE TABLE • Tocreate a new table: • CREATE TABLE table_name ( column_name1 data_type, column_name2 data_type, … );  Create table tbl_Client_details(pk_bint_Client_id bigint PRIMARY KEY,vchr_Client_name varchar(50),vchr_email_id varchar(50),bln_gender boolean,bint_phone_num 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 • Toview 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 presentationhelped you, please visit our page facebook.com/baabtra and like it. Thanks in advance. www.baabtra.com | www.massbaab.com |www.baabte.com
  • 13.