Академический Документы
Профессиональный Документы
Культура Документы
Characteristics of Table
A
Each
The
Each
Table: STUDENT
Rollno Sname
SDOB
Sclass GPA
100
Praveen
12-feb- BSC
1995
4.5
CS
Yes
101
Rajesh
18mar1996
3.5
CS
No
103
Kiran sri
12-jan- Bcom
1999
4.8
CA
NO
104
priyanka
18-jun- BSC
1999
4.2
CS
NO
BSC
Dep_cod Stu_transf
e
er
Keys
In
Primary key
Super key
Candidate key
Foreign key
Secondary key
Primary key
Primary
Super Key
Candidate key
A
Foreign key
A
STU_DETAILS
Sname
Dob
Addr
regno
Sashank
24-jun1999
kurnool
100
sashidhar
14-nov1999
anantapur
110
STU_MARKS
rahul
16-oct2001
Anantapur
120
Regno
M1
M2
M3
TOTAL
AVG
100
90
80
75
245
81.67
110
75
80
90
245
81.67
120
80
90
90
260
86.66
Referential
Secondary
Key
Composite
COURSE_Titl
e
Name
Dept_Nam
Date_complete
Salary
e
d
Fully
Partial
Entity
Integrity :
With in a table, each primary key
value must be unique to ensure
that each row is uniquely
identified by a primary key . In that
case , the table is said to exhibit
entity integrity . To maintain Entity
integrity A NULL is not permitted
in the primary key
Integrity Rules :
Relational database integrity rules are
very important to good database
design. Many (but by no means all)
RDBMSs enforce integrity rules
automatically
Other
NOT
The
UNION :
UNION combines all rows from two tables,
excluding duplicate rows.
The
PART_1
PART_2
PCODE
PNAME
PRICE
1200
Cooker
1500
1300
Oven
9000
1400
Dish
washer
35000
UNION
PCODE
PNAME
PRICE
1600
Refrigerator
12000
1700
Food
processor
8000
1400
Dish washer
35000
PCODE
PNAME
PRICE
1200
Cooker
1500
1300
Oven
9000
1400
Dish washer
35000
1600
Refrigerator
12000
1700
Food
processor
8000
Yields
Intersect :
INTERSECT
The
PART_1
PART_2
PCODE
PNAME
PRICE
1200
Cooker
1500
1300
Oven
9000
1400
Dish
washer
35000
PCODE
PNAME
PRICE
1600
Refrigerator
12000
1700
Food
processor
8000
1400
Dish washer
35000
INTERSECT
Yields
PCODE
PNAME
PRICE
1400
Dish
washer
35000
Difference :
DIFFERENCE yields all rows in one
table that are not found in the other
table; that is, it subtracts one table
from the other.
note that subtracting the first table
from the
second table is not the same as
subtracting the second table from
the first table.
PRODUCT :
PRODUCT
For
PRODUCT
PCODE
PNAME
PRICE
1000
Oven
12000
1200
cooker
1400
Dish
Washer
PSTORE
STORE _NUM
SHELF_NU
M
Atp
100
12
Knl
200
24
1500
35000
Yields
PCODE
PNAME
PRICE
PSTORE
STORE _NUM
SHELF_NU
M
1000
Oven
12000
Atp
100
12
1000
Oven
12000
Knl
200
24
1200
cooker
1500
Atp
100
12
1200
cooker
1500
Knl
200
24
1400
Dish
Washer
35000
Atp
100
12
1400
Dish
Washer
35000
Knl
200
24
SELECT :
SELECT, also known as RESTRICT,
yields values for all rows found in a
table that satisfy a given condition.
SELECT
In
STUDENT
SID
SNAME
ADDRESS
Rahul
Atp
Sashank
Knl
Sri
Atp
Bhargav
Atp
SNAME
ADDRESS
Rahul
Atp
Sashank
Knl
Sri
Atp
Bhargav
Atp
SID
SNAME
ADDRESS
Rahul
Atp
Sri
Atp
Bhargav
Atp
PROJECT
PROJECT
SNAME
ADDRESS
Rahul
Atp
Sashank
Knl
Sri
Atp
Bhargav
Atp
DIVIDE
The
note that:
a. Table 1 is divided by Table 2 to produce Table 3.
Tables 1 and 2 both contain the column CODE but
do not share LOC.
b. To be included in the resulting Table 3, a value in
the unshared column (LOC) must be associated (in
the dividing Table 2) with every value in Table 1.
c. The only value associated with both A and B is 5.
JOINS
JOIN
CUSTOMER
CUST_CODE
CUST_NAME
CUST_ZIP
AGENT_CODE
1000
Vijay
515001
231
2000
Adams
515210
125
3000
Anil
515001
167
4000
Sri
515120
125
AGENT
AGENT_CODE
AGENT_PHONE
231
9945012354
125
9550866409
167
9959847219
CUST_NAME
CUST_ZIP
AGENT_COD
E
AGENT_CODE
AGENT_PHONE
1000
Vijay
515001
231
231
994501235
4
1000
Vijay
515001
231
125
955086640
9
1000
Vijay
515001
231
167
995984721
9
2000
Adams
515210
125
231
994501235
4
2000
Adams
515210
125
125
955086640
9
2000
Adams
515210
125
167
995984721
9
3000
Anil
515001
167
231
994501235
4
3000
Anil
515001
167
125
955086640
9
CUST_NAME
CUST_ZIP
AGENT_COD
E
AGENT_CODE
AGENT_PHONE
1000
Vijay
515001
231
231
994501235
4
2000
Adams
515210
125
125
955086640
9
3000
Anil
515001
167
167
995984721
9 of
output
CUST_NAME
CUST_ZIP
AGENT_COD
E
955086640
9
AGENT_PHONE
1000
Vijay
515001
231
994501235
4
2000
Adams
515210
125
955086640
9
3000
Anil
515001
167
995984721
9
955086640
Data Dictionary :
The data dictionary provides a detailed
description of all tables found within
database.
The data dictionary contains at least all of
the attribute names and characteristics for
each table in the system.
In short, the data dictionary contains
metadata.
Metadata : data about data. Meta data
describes the properties or characteristics
of other data
System Catalog
The
One-One Relationship
In
Emp_num
Dept_code
Prof_name
Dept_name
100
1000
Anil
Computers
200
1500
Sunil
Accounting
300
2000
Swathi
HR
Dept_code
Dept_name
Emp_num
1000
Computers
100
1500
Accounting
200
2000
HR
300
Many-Many Relationship
A
STU_NUM
STU_NAME
CLASS_CODE
101
Vijay
1000
102
Swarna
1001
103
Krishna
1002
104
Aruna
1002
105
Vani
1001
CLASS_CODE
STU_NUM
COURSE_CODE CLASS_SECTIO
N
1000
101
Computers
1001
101
Accounts
1002
102
IT
1001
102
Accounts
In
STU_NUM
STU_NAME
101
Vijay
102
swarna
CLASS_CODE
STU_NUM
ENROLL_GRADE
1001
101
AA
1002
102
AB
1001
102
AC
1000
101
AD
CLASS_CODE
CRS_CODE
CLASS_SECTIO
N
1000
COMPUTERS
1001
ACCOUNTANCY
1002
IT
EXPANDED ER MODEL IS
Data Redundancy
Revisited
Data
redundancy means repetition of
Indexes
An
An
An
DBMS