Relational DB Model Flashcards
Functional relationship/dependency, Primary key, Foreign key, Required and Optional attributes, Attribute Domain, Composite and simple attributes, Single-values and multi-values attributes, Derived attributes, Strong and weak entities (existence dependent), Strong and weak relationships (PK)
Data Definition Language (DDL)
commands responsible for creating, editing and deleting SQL
tables
DDL commands
used to define the structure, names, and types of
the data containers within a database
Data Modeling Steps
- Business Rules, Use cases
- Conceptual Model
- Logical Model
What are business rules?
brief, precise, and unambiguous description of a policy, procedure, or
principle within a specific organization/lab/research area
this helps define entities, attributes, and constraints which distinguishes characteristics of data viewed by company/users
What is functional dependency in DBMS?
describes the
relationship between attributes (columns) in a table
It shows that the value of one attribute determines the other.
So X → Y, where X is Determinant and Y is Dependent
EX: Student ID → Semester
This explains that a semester is dependent on a student ID which determines a specific semester.
Primary key
candidate key chosen
by the DB designer
candidate key
minimal superkey
superkey
set of attributes that
uniquely determine all other attributes
in that relation
foreign key
attribute whose values match the primary key values
in a related table
required attribute
attribute that MUST have a value
optional attribute
attribute that can be NULL
Attribute Domain
set of possible values for a given attribute
Examples:
- Domain for the GPA: [0.0, 4.0]
- Domain for the gender: {Male, Female}
- Domain for the gene start location: positive integer numbers.
Composite attribute
attribute
that can be further subdivided to yield additional attributes
Simple attribute
attribute that cannot be subdivided
Single-value attribute
only one valid
value can be assigned
multi-value attribute
logically have more than one value – this usually occurs
with 1:M and M:N relationships but also with spreadsheet data
derived attribute
attribute that’s computed/calculated from other attributes
strong relationship (existence dependent)
Pros: you cannot
have a child entity without a
parent entity
Cons: composite keys are less
efficient and less flexible than
simple primary keys
weak relationship (existence dependent)
Pros: Simple primary keys are more
efficient and more flexible than
composite primary keys
Cons: it is
possible to have a child entity
without a parent entity
strong entity (PK)
Identifying relationship, when the PK of the related entity contains a PK
component of the parent entity
weak entity (PK)
Non-identifying relationship, does not use the PK of the parent entity as
part of its own PK, but only as a FK
transitive/indirect FD
dependent is indirectly dependent on
determinant
If a → b & b → c, then according
to axiom of transitivity, a → c
Ex: If enrol_no → dept and dept → building_no, then Enrol_no → building_no
Why use FD?
removes redundancy, thereby improving data quality, accuracy and errors. - this is time and cost effective
helps identify poor db design
non-trivial FD
dependent is strictly not a subset of the
determinant
X → Y and Y is not a
subset of X
EXs: roll_no → name, {roll_no, name} → age
trivial FD
dependent
is always a subset of the determinant
X → Y and Y is the subset of X
EXs: {roll_no, name} → name, roll_no → roll_no