RDBMS
Relational model stores data in the form of tables. The relational model consists of three major components:
1. The set of relations and set of domains that defines the way data can be represented (data structure).
2. Integrity rules that define the procedure to protect the data (data integrity).
3. The operations that can be performed on data (data manipulation).
Number of rows present in a relational is known as Tuple.The number of tuples in a relation determines its cardinality.
Each column in the tuple is called an attribute.
The number of attributes in a relation determines its degree.
Domain is the set of all possible values that an
attribute may validly contain.For example-“Number” is a data type and “Age” is a domain.
Keys of a Relation---It is a set of one or more columns whose combined values are unique among all occurrences in a given table.
Primary key is an attribute or a set of
attributes of a relation which posses the properties of uniqueness and
irreducibility.
Foreign key is the attributes of a
table, which refers to the primary key
of some another table.
Super key of an entity set is a set of one or more attributes whose values uniquely determine each entity.
Candidate key: A candidate key of an entity set is a minimal super key.
Entity
An entity
can be a real-world object, either animate or inanimate, that can be easily
identifiable. For example, in a school database, students, teachers, classes,
and courses offered can be considered as entities.
An
entity set may contain entities with attribute sharing similar values. For
example, a Students set may contain all the students of a school.
Entities
are represented by means of their properties, called attributes. For
example, a student entity may have name, class, and age as attributes.
Types of Attributes
- Simple attribute − Simple attributes are atomic values, which cannot be divided further. For example, a student's phone number is an atomic value of 10 digits.
- Composite attribute − Composite attributes are made of more than one simple attribute. For example, a student's complete name may have first_name and last_name.
- Derived attribute − Derived attributes are the attributes that do not exist in the physical database, but their values are derived from other attributes present in the database. For example, average_salary in a department should not be saved directly in the database, instead it can be derived. For another example, age can be derived from data_of_birth.
- Single-value attribute − Single-value attributes contain single value. For example − Social_Security_Number.
- Multi-value attribute − Multi-value attributes may contain more than one values. For example, a person can have more than one phone number, email address, etc.
E-R Notations
The symbols used for the basic ER constructs are
For example An E-R diagram of a entity Person