Databases 3
Databases 3
Lecture # 3
What is RDBMS (Relational Database Management System)
What is table/Relation?
Properties of a Relation:
Student
Roll No Name AGE COURSE
1 A 24 BS
2 B 20 C.A
3 C 21 BCA
4 D 22 MCA
5 E 26 BSC
RDBMS (Relational Database Management System)
Properties of a row:
o All tuples of the relation have the same format and the same
number of entries.
What is a column/attribute?
• A column is a vertical entity in the table which contains all information
associated with a specific field in a table. For example, "name" is a column
in the previous slide table which contains all information about a student's
name.
Properties of an Attribute:
o Attributes that uniquely identify each tuple of a relation are the primary
key.
RDBMS (Relational Database Management System)
• The smallest unit of data in the table is the individual data item. It is stored
at the intersection of tuples and attributes.
o The data items for an attribute should be drawn from the same domain.
o In the below example, the data item in the student table consists of 1, A, 24
and BS etc..
1 A 24 BS
RDBMS (Relational Database Management System)
Degree:
• The total number of attributes that comprise a relation is known as the degree of the
table.
• For example, the student table has 4 attributes, and its degree is 4.
Cardinality:
• The total number of tuples at any one time in a relation is known as the table's
cardinality. The relation whose cardinality is 0 is called an empty table.
• For example, the student table has 5 rows, and its cardinality is 5.
Domain:
• The domain refers to the possible values each attribute can contain. It can be
specified using standard data types such as integers, floating numbers, etc. For
example, An attribute entitled Marital_Status may be limited to married or unmarried
values.
RDBMS (Relational Database Management System)
NULL Values
• The NULL value of the table specifies that the field has been left blank during record
creation. It is different from the value filled with zero or a field that contains space.
Data Integrity
There are the following categories of data integrity exist with each RDBMS:
• Domain integrity: It enforces valid entries for a given column by restricting the
type, the format, or the range of values.
• Referential integrity specifies that rows cannot be deleted, which are used by other
records.
In DBMS, data is generally stored in either a In RDBMS, the tables have an identifier called primary key and the
hierarchical form or a navigational form. data values are stored in the form of tables.
DBMS does not apply any security with regards to RDBMS defines the integrity constraint for the purpose of ACID
data manipulation. (Atomocity, Consistency, Isolation and Durability) property.
DBMS uses file system to store data, so there will in RDBMS, data values are stored in the form of tables, so
be no relation between the tables. a relationship between these data values will be stored in the form
of a table as well.
DBMS has to provide some uniform methods to RDBMS system supports a tabular structure of the data and a
access the stored information. relationship between them to access the stored information.
DBMS does not support distributed database. RDBMS supports distributed database.
DBMS is meant to be for small organization and deal RDBMS is designed to handle large amount of data. it
with small data. it supports single user. supports multiple users.
Examples of DBMS are file systems, xml etc. Example of RDBMS are mysql, postgre, sql server, oracle etc.
Database Languages in DBMS
o A DBMS has appropriate languages and interfaces to express database
queries and updates.
o Database languages can be used to read, store and update the data in the
database.
o DCL stands for Data Control Language. It is used to retrieve the stored or
saved data.
• There are the following operations which have the authorization of Revoke:
Weak Entity:
• An entity that depends on another entity called a weak entity. The weak
entity doesn't contain any key attribute of its own. The weak entity is
represented by a double rectangle.
ER (Entity Relationship) Diagram in DBMS
Attribute
• The attribute is used to describe the property of an
entity. Eclipse is used to represent an attribute.
• For example id, age, contact number, name, etc. can
be attributes of a student.
ER (Entity Relationship) Diagram in DBMS
Key Attribute
Composite Attribute
Derived Attribute
• An attribute that can be derived from other attribute is known as a derived attribute.
It can be represented by a dashed ellipse.
• For example, A person's age changes over time and can be derived from another
attribute like Date of birth.
ER (Entity Relationship) Diagram in DBMS
Relationship
• A relationship is used to describe the relation between entities. Diamond symbol is
used to represent the relationship.
• When only one instance of the entity on the left, and more than one instance of an
entity on the right associates with the relationship then this is known as a one-to-many
relationship.
• For example, Scientist can invent many inventions, but the invention is done by the
only specific scientist.
ER (Entity Relationship) Diagram in DBMS
Many-to-one relationship
• When more than one instance of the entity on the left, and only
one instance of an entity on the right associates with the
relationship then it is known as a many-to-one relationship.
• For example, Student enrolls for only one course, but a course
can have many students.
ER (Entity Relationship) Diagram in DBMS
Many-to-many relationship
• When more than one instance of the entity on the left, and more than one instance
of an entity on the right associates with the relationship then it is known as a many-to-
many relationship.
• For example, Employee can assign by many projects and project can have many
employees.
ER (Entity Relationship) Diagram in DBMS
Notation of ER diagram
• Database can be represented using the notations. In ER diagram, many notations are
used to express the cardinality. These notations are as follows: