01 - rdbms
Post on 06-Apr-2018
262 Views
Preview:
TRANSCRIPT
-
8/3/2019 01 - RDBMS
1/17
RDBMS
A.K.MISHRAJTO(IT)
-
8/3/2019 01 - RDBMS
2/17
Database software...
Light Duty
Medium Dut
Heavy Duty
-
8/3/2019 01 - RDBMS
3/17
Database
What is Data?Nature of Data?
Rows/records
Tables
-
8/3/2019 01 - RDBMS
4/17
Basic Datatypes
NumberDate
Char
-
8/3/2019 01 - RDBMS
5/17
Database ?
A group of tables with relateddata in them is called a Database
some inherent meaning, designed,built and populated for a specific
purpose.
-
8/3/2019 01 - RDBMS
6/17
DatabaseDatabase
title_id = title_id
title_id = title_id
stor_id = stor_id
stor_id = stor_id
pub_id = pub_id
discounts
discounttype varchar(40)
stor_id char(4)
lowqty smallint
highqty smallint
discount decimal
publishers
pub_id char(4)
pub_name varchar(40)
city varchar(20)
state char(2)
countr varchar(30)
salesstor_id char(4)
ord_num varchar(20)
ord_date datetime
qty smallint
payterms varchar(12)
title_id varchar(6)
stores
stor_id char(4)
stor_name varchar(40)
stor_address varchar(40)
city varchar(20)
state char(2)
zip char(5)
titleauthor
au_id varchar(11)
title_id varchar(6)
au_ord tinyint
royaltyper int
titles
title_id varchar(6)
title varchar(80)
type char(12)
pub_id char(4)
price money
title_id = title_id
pub_id = pub_id
pub_id = pub_id
job_id = job_id
au_id = au_id
authors
au_id varchar(11)
au_lname varchar(40)
au_fname varchar(20)
phone char(12)
address varchar(40)
city varchar(20)state char(2)
zip char(5)
contract bitauthors_tmp
au_lname varchar(40)
au_fname varchar(20)
phone char(12)
address varchar(40)
city varchar(20)
state char(2)zip char(5)
employee
emp_id char(9)
fname varchar(20)
minit char
lname varchar(30)
job_id smallint
job_lvl tinyintpub_id char(4)
hire_date datetime
jobs
job_id small int
job_desc varchar(50)min_lvl tinyint
max_lvl tinyint
pub_info
pub_id char(4)
logo image
pr_info text
roysched
title_id varchar(6)
lorange int
hirange int
royalty int
advance money
royalty intytd_sales int
notes varchar(200)
pubdate datetime
-
8/3/2019 01 - RDBMS
7/17
Designing Relational Database
Analyze the situation to gatherinformation about the purpose.
,the lengths of data.
Create the database and tables.
Populate the tables
-
8/3/2019 01 - RDBMS
8/17
Why to use Multiple tables ?
ST. NO NAME DESIG.Course
code
Course
Name
01234 Verma K L SDE 401 Cobol
01234 SDE 412
Start
date
02/01/83
18/07/96Foxpro25Verma K L
erma n ows01234 Verma K L
SDE 415 Win App
02345 Das R K AAO 401 Cobol
02345 DAS R K AAO Foxpro25
103456 Singh R K JTO 415 Win App
412
03/11/98
02/01/83
18/07/96
03/11/98
-
8/3/2019 01 - RDBMS
9/17
Normalizing the Data
Normalizing is the process oforganizing data into related tables.
-Data
-
8/3/2019 01 - RDBMS
10/17
Rules for Normalizing
FNF
Eliminate duplicative columns from the same table. Create separate tables for each group of related data and identify
each row with a unique column (the primary key).
(we must not duplicate data within the same row of a table. )
SNFattempts to reduce the amount of redundant data in a table byextracting it, placing it in new table(s) and creating relationshipsbetween those tables.
TNFAll non-key elements must not depend upon any other non-keycolumns
-
8/3/2019 01 - RDBMS
11/17
Relational Database Objects
Tables
Columns
Data types
Stored ProceduresFunctions
TriggersViews
Indexes
-
8/3/2019 01 - RDBMS
12/17
Database triggers
Programs that are executed whenan event, such as insert or updateon a column occurs in a table.
-
8/3/2019 01 - RDBMS
13/17
Constraints
Constraints are server-based system
implemented data integrity enforcementmechanism.
Primary Keys to enforce uniqueness and
Not-NULL among the rowsForeign Keys are one or more columns
that reference the primary keys or unique
constraints of other table.Rules/checks
-
8/3/2019 01 - RDBMS
14/17
Types of Constraints
NOT NULLUNIQUE
FOREIGN KEY
CHECK
-
8/3/2019 01 - RDBMS
15/17
Concept of Schema
A schema is a logical grouping ofdatabase objects based on theuser who owns them.
DBA: Database Administrator
-
8/3/2019 01 - RDBMS
16/17
SQL (Structured Query Language)
IBM invented SEQUEL(structuredEnglish query language) in 1970sdesi ned for data ueries
SQL sentences are
DDL (data definition language)
DML (data manipulation language)DCL (data control language)
-
8/3/2019 01 - RDBMS
17/17
Any Questions ?
Thank You
top related