Unit I
Unit I
Relational Databases
By
Gauri Kulkarni.
Introduction to Relational Database System:
• Bullet Points:
– Instances: Snapshots of the database at a particular moment.
– Schemas: Describes the structure of the database.
• DBMS Instance
• Definition of instance: The data stored in database at a particular moment of time is called
instance of database. Database schema defines the attributes in tables that belong to a
particular database. The value of these attributes at a moment of time is called the instance
of that database.
• For example, we have seen the schema of table “employee” above. Let’s see the table with
the data now. At this moment the table contains two rows (records). This is the the current
instance of the table “employee” because this is the data that is stored in this table at this
particular moment of time.
• EMP_NAME EMP_ID EMP_ADDRESS EMP_CONTACT ------- ------ ----------- -----------
• Chaitanya 101 Noida 95********
• Ajeet 102 Delhi 99********
• Let’s take another example: Let’s say we have a single table student in the database, today
the table has 100 records, so today the instance of the database has 100 records. We are
going to add another 100 records in this table by tomorrow so the instance of database
tomorrow will have 200 records in table. In short, at a particular moment the data stored in
database is called the instance, this changes over time as and when we add, delete or update
data in the database.
• Data Models
• Title: Data Models:Data Model is the modeling of
the data description, data semantics, and
consistency constraints of the data. It provides the
conceptual tools for describing the design of a
database at each level of data abstraction.
• Bullet Points:
– Conceptual representation of data and relationships.
– Common models: Relational, Hierarchical, Network,
Object-Oriented.
• 1) Relational Data Model: This type of model designs the data in the form of
rows and columns within a table. Thus, a relational model uses tables for
representing data and in-between relationships. Tables are also called
relations. This model was initially described by Edgar F. Codd, in 1969. The
relational data model is the widely used model which is primarily used by
commercial data processing applications.
• 2) Entity-Relationship Data Model: An ER model is the logical representation
of data as objects and relationships among them. These objects are known as
entities, and relationship is an association among these entities. This model
was designed by Peter Chen and published in 1976 papers. It was widely used
in database designing. A set of attributes describe the entities. For example,
student_name, student_id describes the 'student' entity. A set of the same
type of entities is known as an 'Entity set', and the set of the same type of
relationships is known as 'relationship set'.
• 3) Object-based Data Model: An extension of the ER model with notions of
functions, encapsulation, and object identity, as well. This model supports a
rich type system that includes structured and collection types. Thus, in 1980s,
various database systems the object-oriented approach were developed.
Here, the objects are nothing but the data carrying its properties.
• 4) Semistructured Data Model: This type of data model
is different from the other three data models (explained
above). The semistructured data model allows the data
specifications at places where the individual data items
of the same type may have different attributes sets. The
Extensible Markup Language, also known as XML, is
widely used for representing the semistructured data.
Although XML was initially designed for including the
markup information to the text document, it gains
importance because of its application in the exchange of
data.
• Database Architecture
• Title: Database Architecture:The DBMS design depends upon its
architecture. The basic client/server architecture is used to deal with a
large number of PCs, web servers, database servers and other
components that are connected with networks.
• The client/server architecture consists of many PCs and a workstation
which are connected via the network.
• DBMS architecture depends upon how users are connected to the
database to get their request done.
• Components:
– Data storage.
– Data retrieval and manipulation.
– Query processing and optimization.
• Types of Architecture:
• 1-Tier Architecture
• In this architecture, the database is directly available to the user. It means the user can
directly sit on the DBMS and uses it.
• Any changes done here will directly be done on the database itself. It doesn't provide a
handy tool for end users.
• The 1-Tier architecture is used for development of the local application, where
programmers can directly communicate with the database for the quick response.
• 2-Tier Architecture
• The 2-Tier architecture is same as basic client-server. In the two-tier architecture,
applications on the client end can directly communicate with the database at the
server side. For this interaction, API's like: ODBC, JDBC are used.
• The user interfaces and application programs are run on the client-side.
• The server side is responsible to provide the functionalities like: query processing and
transaction management.
• To communicate with the DBMS, client-side application establishes a connection with
the server side.
2-tier Architecture
• Three-Tier Architecture
• Title: Three-Tier Architecture:The 3-Tier architecture contains another layer
between the client and server. In this architecture, client can't directly
communicate with the server.
• The application on the client-end interacts with an application server which
further communicates with the database system.
• End user has no idea about the existence of the database beyond the
application server. The database also has no idea about any other user beyond
the application.
• The 3-Tier architecture is used in case of large web application.
• Bullet Points:
– Presentation layer.
– Application layer.
– Data layer.
o. DBMS RDBMS
1) DBMS applications store data as file. RDBMS applications store data in a tabular form.
2) In DBMS, data is generally stored in either a In RDBMS, the tables have an identifier called primary
hierarchical form or a navigational form. key and the data values are stored in the form of tables.
4) DBMS does not apply any security with RDBMS defines the integrity constraint for the
regards to data manipulation. purpose of ACID (Atomocity, Consistency, Isolation and
Durability) property.
5) DBMS uses file system to store data, so there in RDBMS, data values are stored in the form of tables,
will be no relation between the tables. so a relationship between these data values will be
stored in the form of a table as well.
6) DBMS has to provide some uniform methods RDBMS system supports a tabular structure of the data
to access the stored information. and a relationship between them to access the stored
information.
9) Examples of DBMS are file systems, xml etc. Example of RDBMS are mysql, postgre, sql
server, oracle etc
• Database Users and Administrators
• Title: Database Users and Administrators
• Database users are categorized based up on their interaction with the
database. These are seven types of database users in DBMS.
• Naive / Parametric End Users : Parametric End Users are the
unsophisticated who don’t have any DBMS knowledge but they frequently
use the database applications in their daily life to get the desired results.
For examples, Railway’s ticket booking users are naive users. Clerks in any
bank is a naive user because they don’t have any DBMS knowledge but
they still use the database and perform their given task.
• System Analyst :
System Analyst is a user who analyzes the requirements of parametric end
users. They check whether all the requirements of end users are satisfied.
• Sophisticated Users : Sophisticated users can be engineers, scientists, business analyst, who are familiar
with the database. They can develop their own database applications according to their requirement. They
don’t write the program code but they interact the database by writing SQL queries directly through the
query processor.
• Database Designers : Data Base Designers are the users who design the structure of database which
includes tables, indexes, views, triggers, stored procedures and constraints which are usually enforced
before the database is created or populated with data. He/she controls what data must be stored and how
the data items to be related. It is responsibility of Database Designers to understand the requirements of
different user groups and then create a design which satisfies the need of all the user groups.
• Application Programmers : Application Programmers also referred as System Analysts or simply Software
Engineers, are the back-end programmers who writes the code for the application programs. They are the
computer professionals. These programs could be written in Programming languages such as Visual Basic,
Developer, C, FORTRAN, COBOL etc. Application programmers design, debug, test, and maintain set of
programs called “canned transactions” for the Naive (parametric) users in order to interact with database.
• Casual Users / Temporary Users : Casual Users are the users who occasionally use/access the database but
each time when they access the database they require the new information, for example, Middle or higher
level manager.
• Specialized users : Specialized users are sophisticated users who write
specialized database application that does not fit into the traditional data-
processing framework. Among these applications are computer aided-design
systems, knowledge-base and expert systems etc.
• Bullet Points:
– Manages and maintains the database system.
– Ensures data security and integrity.
– Performance optimization.
• Introduction to the Relational Model
• Title: Introduction to the Relational Model
• Structure of Relational Database:
– Tables (relations) with rows (tuples) and columns
(attributes).
• Database Schema and Keys
• Title: Database Schema and Keys
• Bullet Points:
– Blueprint of the database structure.
– Primary keys uniquely identify a record.
– Foreign keys establish relationships between
tables.
• Relational Query Language (SQL)
• Title: Relational Query Language (SQL)
• Bullet Points:
– SELECT, FROM, WHERE clauses for data retrieval.
– JOIN operations for combining data from multiple
tables.
• The Relational Algebra
• Title: The Relational Algebra
• Fundamental Operations:
– Selection, Projection, Cartesian Product, Union,
Set Difference.
• Formal Definition and Additional Operations.
• The Entity-Relationship Model
• Title: The Entity-Relationship Model
• Entity Set, Relationship Set, and Attributes.
• Constraints in the ER Model
• Title: Constraints in the ER Model
• Mapping Cardinalities, Key Constraints,
Participation Constraints.
• E-R Diagrams
• Title: E-R Diagrams
• Basic Structure, Complex Attributes, Roles.
Non-Binary Relationship Sets and Weak Entity
Set
Title: Non-Binary Relationship Sets and Weak
Entity Set
Ternary, quaternary, etc.
Entity that cannot be uniquely identified by its
attributes alone.
Relational Database Design using ER-to-
Relational Mapping
Title: Relational Database Design using ER-to-
Relational Mapping
Transforming ER diagrams into relational
schemas.
• Extended ER Features
• Title: Extended ER Features
• Specialization and Generalization, Attribute
Inheritance.
• Constraints on Generalization, Aggregation.