Professional Documents
Culture Documents
Oracle-Cardnality and Constraints
Oracle-Cardnality and Constraints
Constraint in DBMS
A.Bathsheba Parimala
Assistant Professor
Dept.of BCA& M.Sc(NT&IT)
St.Johns college,Palayamkottai
Constraints
E1 1
E2 2
D1
E3 3
D2
E4 4
D3
E5 5
E6 6
employee
Work for Department
ER diagram
N 1
Work For Department
Employee
Min/Max Representation
(1,1) (0,N)
Employee Work For Department
E1
E2 1 D1
E3 2 D2
E4 3 D3
4 D4
Requirement Analysis:
Every Department should have a manager & only one employee manages a department.
Uniqueness of data
Cardinality in SQL
Cardinality refers to the uniqueness of data contained in a
column.
If a column has a lot of duplicate data (e.g. a column that
stores either "true" or "false"), it has low cardinality,
but if the values are highly unique (e.g. Social Security
numbers), it has high cardinality.
For example, let’s say we have a table with a “Gender”
column which has only two possible values of “Male” and
“Female”.
Then, that “Gender” column would have a cardinality of 2,
because there are only two unique values that could possibly
appear in that column .
Let’s say that we have a primary key column on
a table with 10,000 rows. What do you think the
cardinality of that column would be?
high
cardinality
Data SQL
Partial Total
modeling statements
low
cardinality
One-to-One
One-to-Many
Many-to-Many