Database design

400 views
337 views

Published on

Database design

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
400
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
17
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Database design

  1. 1. Disclaimer: This presentation is prepared by trainees ofbaabtra as a part of mentoring program. This is not officialdocument of baabtra –Mentoring PartnerBaabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .Ltd
  2. 2. DATABASE DESIGNING Reshmi reshmi@ymail.com www.facebook.com/reshmi. ramaswami twitter.com/username in.linkedin.com/in/profilena me Phonenumber
  3. 3. 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;
  4. 4. PROBLEM STATEMENT• Design a database for a travelling agency to track its customers and their booking. It can have maximum two tables.
  5. 5. 1.Tbl_customer Fields DatatypeVchr_Customer_name varchar(20)pk_bint_Client_id Big intvchr_email_id Varchar(20)bln_gender Booleanbint_cust_phone Bigint
  6. 6. 2.Tbl_booking Fields Datatypepk_ticket_no integervchr_Source varchar(20)vchr_Destination varchar(20)dat_Date_of_jrny datedat_Date_of_Bookg datefk_bint_Client_id bigint
  7. 7. 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);
  8. 8. 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);
  9. 9. 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.
  10. 10. 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,…. );
  11. 11. 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
  12. 12. Contact Us

×