DBMS Data Models Flashcards
What is a key
A key is a attribute used to uniquely identify rows/tupples
Whats a candidate key?
A candidate key is used to uniquely differ between some tupples which are coincidently matching.
In short they are never equal and hence can be used to uniquely Identify
A candidate key is a minimal super key, or a super key with no redundant attributes.
Whats a primary key?!
A primary key can be assumed a mixture of candidate key and a condition that it can never be null.(Unique+ Not Null)
A primary key may have one or more attributes.
Whats a Foreign Key!?
It is an attribute or set of attributes, that references to primary key of same table or another table
Whats needed for a foreign key to work!?
There must be atleast one same column in both the table ( the main one and the foreign one)
Whats Reference Table and Referencing Table?
The table containing Foreign Key is called Referencing Table
Explain Relational Model
Relational Model
* Relational Model is the most widely used model.
* In this model, the data is maintained in the form of a two-dimensional tables called Relation.
* All the information is stored in the form of rows and columns where columns represents attributes and
row represents records or tuples.
Whats integrity Constraints
Integrity Constraints
Integrity constraints are a set of rules. It is used to maintain the quality of information.
Integrity constraints ensure that the data insertion, updating, and other processes have to be
performed in such a way that data integrity is not affected.
Thus, integrity constraint is used to guard against accidental damage to the database.
Whats Check Constraint
Check
This constraint defines a business rule on a column. All the rows in that column must satisfy this rule.
Limits the data values of variables to a specific set, range, or list of values.
Define entity
An entity is a person, a place or an object that is distinguishable from other objects based on
the values of the attributes it possess.
Define Relation Schema
A relation schema represents name of the relation with its attributes.
e.g.; STUDENT (ROLL_NO, NAME, branch, semester, SPI) is relation schema for STUDENT.
* If a schema has more than 1 relation, it is called Relational Schema.
Define Relation Instance:
Relation Instance: The set of tuples of a relation at a particular instance of time is called as relation instance.
It can change whenever there is insertion, deletion or updation in the database.
Define Degree
Degree: The number of columns or attributes in the relation is known as degree of the
relation.
Define Cardinality
Cardinality: The number of rows or tuples in a relation is known as cardinality.
Relation Key
Relation key: Every row has one or multiple attributes, that can uniquely identify the row in the relation, which is called relation key or primary key.
how does integrity constraints guard data against accidental damage
Integrity constraints are a set of rules .
} They are used to ensure accuracy and consistency of the data in a relational database.
} Integrity constraints ensure that the data insertion, updation, and deletion made to the
database by authorized users do not result in a loss of data consistency.
} Thus, integrity constraint is used to guard against accidental damage to the database.
Whats Key contraint
No two tuples in a relation have same value for all attributes. To ensure that we choose key constraint.
Whats Key constraint
No two tuples in a relation have same value for all attributes. To ensure that we choose key constraint.
Whats Referential integrity Constraint
A referential integrity constraint is specified between two tables.
Ê referential integrity constraint is enforced when a foreign key references the primary key of a table.
Ê In the referential integrity constraints, if a foreign key column in table 1 refers to the primary key column of
table 2, then every value of the foreign key column in table 1 must be null or be available in primary key column of table 2.
Explain the Rules for converting ER model to database schema
Rule1: For Strong entities with only Simple Attributes.
Each attribute turns into a column in the table
Rule2: For Strong entities with composite Attributes
} A strong entity set with any number of composite attributes will require only one table in relational model.
} While conversion, simple attributes of the composite attributes are taken into account and not the composite attribute itself.
Rule 3: For Strong Entities with Multi-valued Attributes:
} For each multivalued attribute A, create a new table.
} Add the primary key column into multi-value
attribute’s table.
} If the multivalued attribute is composite, we include its simple components.
Rule 4:For Binary Relationship With Weak Entity Set
Weak entity set always appears in association with identifying relationship with total
participation constraint.
Explain the Rules for converting ER model to database schema
Rule1: For Strong entities with only Simple Attributes.
Each attribute turns into a column in the table
Rule2: For Strong entities with composite Attributes
} A strong entity set with any number of composite attributes will require only one table in relational model.
} While conversion, simple attributes of the composite attributes are taken into account and not the composite attribute itself.
Rule 3: For Strong Entities with Multi-valued Attributes:
} For each multivalued attribute A, create a new table.
} Add the primary key column into multi-value
attribute’s table.
} If the multivalued attribute is composite, we include its simple components.
Rule 4:For Binary Relationship With Weak Entity Set
Weak entity set always appears in association with identifying relationship with total
participation constraint.