KEMBAR78
Introduction of DBMS | PDF | Relational Database | Relational Model
0% found this document useful (0 votes)
287 views83 pages

Introduction of DBMS

This document outlines the syllabus for the DSC 303 Paper Code course. The course covers basic concepts of database management systems including the relational and ER models, database integrity and normalization, file organization, SQL, transactions and concurrency, database recovery and security, distributed and client server databases, and advanced topics. The syllabus is divided into 5 units covering these concepts and includes a lab component involving SQL queries.

Uploaded by

Om Prakash Yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
287 views83 pages

Introduction of DBMS

This document outlines the syllabus for the DSC 303 Paper Code course. The course covers basic concepts of database management systems including the relational and ER models, database integrity and normalization, file organization, SQL, transactions and concurrency, database recovery and security, distributed and client server databases, and advanced topics. The syllabus is divided into 5 units covering these concepts and includes a lab component involving SQL queries.

Uploaded by

Om Prakash Yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 83

Paper Code- DSC 303

B.Com III semester


Objective
To acquire basic conceptual background necessary
to design and develop simple database system,
Relational database mode, ER model and distributed
databases, and to write good queries using a
standard query language called SQL.
Syllabus
UNIT-I:
• BASIC CONCEPTS: Database Management System - File based system –
Advantages of DBMS over file based system - Database Approach - Logical DBMS
Architecture - Three level architecture of DBMS or logical DBMS architecture -
Need for three level architecture - Physical DBMS Architecture - Database
Administrator (DBA) Functions & Role - Data files indices and Data Dictionary -
Types of Database.
• Relational and ER Models: Data Models - Relational Model – Domains - Tuple and
Relation - Super keys - Candidate keys - Primary keys and foreign key for the
Relations – Relational Constraints - Domain Constraint - Key Constraint - Integrity
Constraint - Update Operations and Dealing with Constraint Violations - Relational
Operations - Entity Relationship (ER) Model – Entities – Attributes – Relationships
- More about Entities and Relationships - Defining Relationship for College
Database - E-R Diagram - Conversion of E-R Diagram to Relational Database.
UNIT-II
• DATABASE INTEGRITY AND NORMALISATION: Relational Database
Integrity - The Keys - Referential Integrity - Entity Integrity - Redundancy
and Associated Problems – Single Valued Dependencies.
• Normalisation - Rules of Data Normalisation - The First Normal Form -The
Second Normal Form - The Third Normal Form - Boyce Codd Normal Form
- Attribute Preservation – Loss less join Decomposition - Dependency
Preservation.
• File Organisation : Physical Database Design Issues - Storage of Database
on Hard Disks - File Organisation and Its Types - Heap files (Unordered
files) - Sequential File Organisation - Indexed (Indexed Sequential) File
Organisation - Hashed File Organisation - Types of Indexes - Index and
Tree Structure - Multi-key File Organisation - Need for Multiple Access
Paths - Multi-list File Organisation - Inverted File Organisation.
UNIT-III
• STRUCTURES QUERY LANGUAGE (SQL):Meaning–SQL commands – Data Definition
Language(DDL) - Data Manipulation Language(DML) - Data Control Language (DCL) -
Transaction Control Language (TCL)
• Queries using: Order by – Where - Group by - Nested Queries.
• Joins : Views – Sequences - Indexes and Synonyms - Table Handling.

UNIT-IV
TRANSACTIONS AND CONCURRENCY MANAGEMENT: Transactions – Concurrent
Transactions - Locking Protocol - Serialisable Schedules - Locks Two Phase
Locking (2PL) - Deadlock and its Prevention - Optimistic Concurrency Control.
Database Recovery and Security: Database Recovery meaning - Kinds of failures -
Failure controlling methods - Database errors – Backup & Recovery Techniques -
Security & Integrity - Database Security - Authorization.
UNIT-V
• DISTRIBUTED AND CLIENT SERVER DATABASES : Need for Distributed
Database Systems - Structure of Distributed Database - Advantages and
Disadvantages of DDBMS - Advantages of Data Distribution -
Disadvantages of Data Distribution - Data Replication – Data
Fragmentation.
• Client Server Databases: Emergence of Client Server Architecture - Need
for Client Server Computing - Structure of Client Server Systems & its
advantages.
• ADVANCED TOPICS: Overview: Parallel Database - Multimedia Database -
Mobile Database – Web Database - Multidimensional Database. Data
Warehouse - OLTP v/s OLAP – No SQL Database.

LAB: SQL QUERIES BASED ON VARIOUS COMMANDS


UNIT-I
BASIC CONCEPTS
Data is raw material or facts and statistics stored or free flowing
over a network, generally it's raw and unprocessed.
your name - it's data, your age, it's data.

Information: It is a processed data or Data becomes information


when it is processed, turning it into something meaningful.

aurora B.com year section

Database: A Database is a collection of related data organized in a


way that data can be easily accessed, managed and updated. Database
can be software based or hardware based, with one sole purpose,
storing data
Data

Capture Data

Manipulate

Output / Results

Information
Data Processing System
Need of Information
• To gain knowledge about surrounding and
whatever is happening in the society and universe.
• To keep the system up-to-date we need to gather
information from various sources like news paper,
radio, magazine, television, internet etc.
• To know about the rules and regulation of society,
government and association etc.
• To arrive at a particular decision that helps in
forming and protecting system.
Data Hierarchy
• BIT- 0, 1.
• BYTE- 8 bit.
• FIELD- Group of character. BIT

• RECORD- Group of related fields. BYTE


• FILE- Collection of related
records FIELD

• DATABASE- Collection of
RECORD FILE
related files.
DATABASE
Database Application/ Uses
• Banking
• University
• Airlines
• Railway Reservation/ Bus Reservation
• Sales
• Telecommunication
• Manufacturing
• Human Resources
Approaches to Data Management
• Two approaches used for data management
through computer
1. File Based System approach
2. Database Approach
1. File Processing System: A file system is a method for storing and
organizing computer files and the data they contain to make it easy
to find and access them. File systems may use a storage device such
as a hard disk or CD-ROM and involve maintaining the physical
location of the files.
Characteristics of File Base System
• It is a group of files storing data of an organization.
• Each file is independent from one another.
• Each file is called a flat file.
• Each file contained and processed information for one specific
function, such as accounting or inventory.
• Files are designed by using programs written in programming
languages such as COBOL, C, C++.
• Each file must have its own file management system.
Disadvantages of file system include:
• Separated and Isolated Data
• Duplication of data (Redundancy)
• Data Dependence & Inconsistency
• Difficulty in accessing data
• Concurrent access anomalies
• Security problem
• Integrity problems
• Atomicity Problem
• Data Inflexibility
• Incompatible file formats
• Data Security
• Transactional Problems
2. DBMS: A DBMS is a software that allows creation, definition and
manipulation of database, allowing users to store, process and analyse
data easily. DBMS provides us with an interface or a tool, to perform
various operations like creating database, storing data in it, updating
data, creating tables in the database and a lot more.
“Relational Database Management System" An RDBMS is a DBMS
 designed specifically for relational databases. Therefore, RDBMSes
are a subset of DBMS.

Here are some examples of popular RDBMS:

Oracle IBM DB2


MySql PostgreSQL
SQL Server Amazon SimpleDB (cloud based) etc.
Role of Managing Data
• To use DBMS well, it is necessary to also
understand how a DBMS works:
– Database Design and Application development
– Data Analysis
– Concurrency and Robustness
– Efficiency
– Scalability
Advantages of RDBMS over file system
• Program data independency
• Reducing Data Redundancy
• Sharing of Data
• Data Integrity( improved)
• Data Security
• Privacy
• Backup and Recovery
• Data Consistency
• Data Administration
Program data independency
In EDBMS, data is stored in a central location called repository. The
process of database allows an enterprise’s data to change the database
without modifying the application programs which are able to process
this data. This allows the separation of database from the application
programs.

Reducing Data Redundancy


The file based data management systems contained multiple files that
were stored in many different locations in a system or even across
multiple systems. Because of this, there were sometimes multiple copies
of the same file which lead to data redundancy. 
Sharing of Data
In a database, the users of the database can share the data among themselves.
There are various levels of authorisation to access the data, and consequently
the data can only be shared based on the correct authorisation protocols
being followed. Many remote users can also access the database
simultaneously and share the data between themselves.

Data Integrity
Data integrity means that the data is accurate and consistent in the database.
Data Integrity is very important as there are multiple databases in a DBMS.
All of these databases contain data that is visible to multiple users. So it is
necessary to ensure that the data is correct and consistent in all the
databases and for all the users. 
Data Security
Data Security is vital concept in a database. Only authorised users should
be allowed to access the database and their identity should be
authenticated using a username and password. Unauthorised users should
not be allowed to access the database under any circumstances as it
violates the integrity constraints.

Privacy
The privacy rule in a database means only the authorized users can access
a database according to its privacy constraints. There are levels of
database access and a user can only view the data he is allowed to. For
example - In social networking sites, access constraints are different for
different accounts a user may want to access.
Backup and Recovery
Relational Database Management System automatically takes care of backup
and recovery. The users don't need to backup data periodically because this is
taken care of by the DBMS. Moreover, it also restores the database after a
crash or system failure to its previous condition. 

Data Consistency
Data consistency is ensured in a database because there is no data redundancy.
All data appears consistently across the database and the data is same for all
the users viewing the database. Moreover, any changes made to the database
are immediately reflected to all the users and there is no data inconsistency
Data Administration
Data administration is the process by which data is monitored,
maintained and managed by a data administrator and/or an
organization. Data administration allows an organization to control its
data assets, as well as their processing and interactions with different
applications and business processes. Data administration ensures that
the entire life cycle of data use and processing is on par with the
enterprise’s objective
Disadvantage of RDBMS
➨Software is expensive.
➨Complex software refers to expensive hardware
and hence increases overall cost to avail the
RDBMS service.
➨It requires skilled human resources to implement.
➨Certain applications are slow in processing.
➨It is difficult to Backup and recover the lost data.
➨ Security Threats.
DBMS Architecture
The architecture explains database concepts, structure and
capabilities of a DBMS.

There are two different views of DBMS Architecture .


They are:
 Three level architecture of DBMS or Logical architecture
 Physical DBMS Architecture

The logical architecture deals with the way data is stored and
presented to users, while the physical architecture is concerned
with the software components that makes up a DBMS.
Three Level Architecture of Database

Logical database
Architecture deals with
the way data is stored
and presented to users.
Physical Level
This is the lowest level in the three level architecture.
It is also known as the internal level. The physical
level describes how data is actually stored in the
database. In the lowest level, this data is stored in the
external hard drives in the form of bits and at a little
high level, it can be said that the data is stored in files
and folders. The physical level also discusses
compression and encryption techniques.
Conceptual Level
The conceptual level is at a higher level than the
physical level. It is also known as the logical level. It
describes how the database appears to the users
conceptually and the relationships between various
data tables. The conceptual level does not care for
how the data in the database is actually stored.
External Level
This is the highest level in the three level
architecture and closest to the user. It is also
known as the view level. The external level only
shows the relevant database content to the users in
the form of views and hides the rest of the data. So
different users can see the database as a different
view as per their individual requirements.
Physical Architecture
• Database systems are partitioned into modules for
different functions. Components of database
systems include:
– File manager - manages allocation of disk
space and data structures used to represent
information on disk.
– Database manager: The interface between low-
level data and application programs and queries.
– Query processor translates statements in a query
language into low-level instructions the database
manager understands. (May also attempt to find an
equivalent but more efficient form.)
– DML Precompiler converts DML statements
embedded in an application program to normal
procedure calls in a host language. The
Precompiler interacts with the query processor.
– DDL compiler converts DDL statements to a set
of tables containing metadata stored in a data
dictionary.
– Run-time processor – The run-time processor
handles retrieval or update operations
expressed against database.
– Query processor – The query processor
handles interactive queries expressed in data
manipulation language (DML) such as SQL. It
parses and analyses a query before generating
calls to the run-time
• In addition, several data structures are required for
physical system implementation:

– Data files: store the database itself.


– Indices: provide fast access to data items
holding particular values.
– Data dictionary: stores information about the
structure of the database. It is used heavily.
Database Administrator (DBA) Functions and Role
One of the main reasons for using DBMS is to have a central
control of both data and the programs accessing those data.
A person who has such control over the system is called a
Database Administrator.
The following are the functions of a database administrator
 Schema definition
 Storage structure and access method definition
 Schema and physical organization modification
 Granting authorization for data access
 Routine maintenance
 Security
Schema Definition
he DBA definition the logical Schema of the database. A
Schema refers to the overall logical structure of the database.
According to this schema, database will be developed to store
required data for an organization.

Data definition
The DBMS provides functions to define the structure of the
data in the application. These include defining and modifying
the record structure, the type and size of fields and the
various constraints/conditions to be satisfied by the data in
each field.
Data Manipulation
Once the data structure is defined, data needs to be inserted, modified
or deleted. The functions which perform these operations are also
part of the DBMS. These functions can handle planned and
unplanned data manipulation needs. Planned queries are those which
form part of the application. Unplanned queries are ad-hoc queries
which are performed on a need basis.

Granting authorization for data access


The DBA provides different access rights to the users according to
their level. Ordinary users might have highly restricted access to data.
Routine Maintenances
 Taking backup of database periodically.
 Ensuring enough disk space is available all the time.
 Monitoring jobs running on the database.
 Ensure that performance is not degraded by some expensive task
submitted by some users.

Security
Security classifications are implemented that identify which user groups
are authorized to access specific data elements in the database and what
actions may be performed thereon. Computer operations are frequently
monitored to assure that these access controls are functioning in the
intended way.
Types of databases :
Databases can be classified according to the number
of users, location of DB, and the uses.

User: single- user and multi-user


Location: Centralized – Distributed
Usage: Operational – Data Warehouse
Data Models
A Database model defines the logical design and
structure of a database and defines how data will be
stored, accessed and updated in a database management
system. While the Relational Model is the most widely
used database model, there are other models too:
 Hierarchical Model
 Network Model
 Object-oriented model
 Entity-relationship Model
 Relational Model
Hierarchical Database
Data storage is in the form
of a tree.  It collects all
records together as a record
type. These record types are
the equivalent of tables in
the relational model, and
with the individual records
being the equivalent of rows.
Network Model
In network databases, children
are called members and parents
are an occupier. The difference
between each child or member
can have more than one parent.
A large digital computer mainly
uses network database. The
network database is more
efficient. Therefore is similar to
the hierarchical database.
Object-oriented data model
This data model is another method of representing
real world objects. It considers each object in the
world as objects and isolates it from each other. It
groups its related functionalities together and allows
inheriting its functionality to other related sub-groups
Object-oriented model
Relational Model
In relational databases, the relationship between data files is relational.
Hierarchical and network databases require the user to pass a hierarchy in order
to access needed data. These databases connect to the data in different files by
using common data numbers or a key field. Therefore relational database is the
most popular database type
Entity-Relationship Model
Entity-Relationship (ER) Model is based on the notion of
real-world entities and relationships among them. While
formulating real-world scenario into the database model,
the ER Model creates entity set, relationship set, general
attributes and constraints.
ER Model is best used for the conceptual design of a
database.
ER Model is based on −
Entities and their attributes.
Relationships among entities.
Entity-Relationship Model
Relational model
Relational Model was proposed by E.F. Codd to model data
in the form of relations or tables.

Benefits of Relational Model:


Ease of use
Flexible
Accuracy
IMPORTANT TERMINOLOGIES

Attribute: Attributes are the properties that define a relation.


e.g.; ROLL_NO, NAME
Relation Schema: A relation schema describes the structure of the relation,
with the name of the relation(name of table), its attributes and their names and
type.
e.g.; STUDENT (ROLL_NO, NAME, ADDRESS, PHONE and AGE) is
relation schema for STUDENT.
Tuple: Each row in the relation is known as tuple. The above relation contains
4 tuples, one of which is shown as:
Relational Keys

KEY  is an attribute or set of attributes which helps you to identify a row(tuple) in a
relation(table). They allow you to find the relation between two tables. Keys help you
uniquely identify a row in a table by a combination of one or more columns in that
table. Key is also helpful for finding unique record or row from the table. Database key
is also helpful for finding unique record or row from the table.

Primary Key – A primary is a column or set of columns in a table that uniquely identifies
tuples (rows) in that table.
Super Key – A super key is a set of one of more columns (attributes) to uniquely identify
rows in a table.
Candidate Key – A super key with no redundant attribute is known as candidate key
Alternate Key – Out of all candidate keys, only one gets selected as primary key,
remaining keys are known as alternate or secondary keys.
Composite Key – A key that consists of more than one attribute to uniquely identify rows
(also known as records & tuples) in a table is called composite key.
Foreign Key – Foreign keys are the columns of a table that points to the primary key of
another table. They act as a cross-reference between tables.
student Sid(PK) Sname contact
1001 aa 99999

marks Mid(PK) sub1 Sub2 sub3 Sid(FK)


m1 54 45 25 1001

topper Sid MId


RELATIONAL CONSTRAINTS
 
Every relation has some conditions that must hold for
it to be a valid relation. These conditions are called
Relational Integrity Constraints. There are three
main integrity constraints −
Domain constraints
Key constraints
Integrity constraints
Domain Constraints
A domain of possible values should be associated with every
attribute. Domain is a set of atomic data values with unique
data type in the relational Database. Domain Constraints is
used to implicitly validate date when Insert or update
statements are executed in Relational database. Some of the
examples are:

NOT NULL
DEFAULT
CHECK
Key Constraints
There must be at least one minimal subset of attributes in the
relation, which can identify a tuple uniquely. This minimal subset of
attributes is called key for that relation. If there are more than one
such minimal subsets, these are called candidate keys.
Key constraints force that −
•in a relation with a key attribute, no two tuples can have identical
values for key attributes.
•a key attribute can not have NULL values.
Key constraints are also referred to as Entity Constraints.
- Primary key constraint
- Unique key constraint
Example- Consider the following Student table

STU_ID Name Age

S001 Akshay 20

S001 Abhishek 21

S003 Shashank 20

S004 Rahul 20
Integrity constraints

There are two types of integrity constraints;


 Entity Integrity Constraint
 Referential Integrity Constraint
Entity Integrity Constraint

It states that no primary key value can be Null. This because the
primary key is used to identify individual tuple in the relation.

Referential Integrity Constraint


This constraint is enforced when a foreign key references the
primary key of a relation.
It specifies that all the values taken by the foreign key must either
be available in the relation of the primary key or be null.
Relational Algebra
Relational algebra is a procedural query language. It gives a step by step process to
obtain the result of the query. It uses operators to perform queries.

Types of Relational operation


Select
Project
Union
Set Intersection
Set Difference
Cartesian product
Rename Operation
1. Select Operation:

The select operation selects tuples (records or rows)that satisfy a given


predicate.
It is denoted by sigma (σ).

Notation:  σ p(r)  

Where:
σ is used for selection prediction
r is used for relation
p is used as a propositional logic formula which may use connectors
like: AND OR and NOT. These relational can use as relational operators
like =, ≠, ≥, <, >, ≤.
For example: LOAN Relation
BRANCH_NAME LOAN_NO AMOUNT
Downtown L-17 1000
Redwood L-23 2000
Perryride L-15 1500
Downtown L-14 1500
Mianus L-13 500
Roundhill L-11 900
Perryride L-16 1300

Input:
σ  BRANCH_NAME="perryride" (LOAN)
BRANCH_NAME LOAN_NO AMOUNT
Output:
Perryride L-15 1500
Perryride L-16 1300
2. Project Operation:

This operation shows the list of those attributes (column)


that we wish to appear in the result. Rest of the attributes
are eliminated from the table.
It is denoted by ∏.
Notation: ∏ A1, A2, An (r)   
Where
A1, A2, A3 is used as an attribute name of relation r.
Example: CUSTOMER RELATION

NAME STREET CITY


Jones Main Harrison
Smith North Rye
Hays Main Harrison
Curry North Rye
Johnson Alma Brooklyn
Brooks Senator Brooklyn

Output: NAME CITY


Input:
Jones Harrison
∏ NAME, CITY (CUSTOMER) 
Smith Rye
Hays Harrison
Curry Rye
Johnson Brooklyn
Brooks Brooklyn
3. Union Operation:
Suppose there are two tuples R and S. The union operation
contains all the tuples that are either in R or S or both in R
& S.
It eliminates the duplicate tuples. It is denoted by ∪.
Notation: R ∪ S   
A union operation must hold the following condition:
R and S must have the attribute of the same number.
Duplicate tuples are eliminated automatically.
DEPOSITOR BORROW
Example: CUSTOMER_NAME ACCOUNT_NO CUSTOMER_NAME LOAN_NO
Johnson A-101 Jones L-17
Smith A-121 Smith L-23
Mayes A-321 Hayes L-15
Turner A-176 Jackson L-14
Johnson A-273 Curry L-93
Jones A-472 Smith L-11
Lindsay A-284 Williams L-17

Input: ∏ CUSTOMER_NAME (BORROW) ∪ ∏ CUSTOMER_NAME (DEPOSITOR)  
CUSTOMER_NAME
Output: Johnson
Smith
Hayes
Turner
Jones
Lindsay
Jackson
Curry
Williams
Mayes
4. Set Intersection:
Suppose there are two tuples R and S. The set intersection operation contains
all tuples that are in both R & S.
It is denoted by intersection ∩.
Notation: R ∩ S   
Example: Using the above DEPOSITOR table and BORROW table
  
DEPOSITOR BORROW
CUSTOMER_NAME ACCOUNT_NO CUSTOMER_NAME LOAN_NO
Jones L-17 Output:
Johnson A-101
Smith A-121 Smith L-23
Mayes A-321 Hayes L-15 CUSTOMER_NAME
Jackson L-14
Turner A-176 Smith
Johnson A-273 Curry L-93
Jones A-472 Smith L-11 Jones
Lindsay A-284 Williams L-17

Input:
∏ CUSTOMER_NAME (BORROW)  ∩ ∏ CUSTOMER_NAME (DEPOSITOR)
5. Set Difference:
Suppose there are two tuples R and S. The set intersection operation contains all
tuples that are in R but not in S.
It is denoted by intersection minus (-).
Notation: R - S  
Example: Using the above DEPOSITOR table and BORROW table

DEPOSITOR BORROW Output:


CUSTOMER_NAME ACCOUNT_NO CUSTOMER_NAME LOAN_NO
Johnson A-101 Jones L-17 CUSTOMER_NAME
Smith A-121 Smith L-23 Jackson
Mayes A-321 Hayes L-15 Hayes
Turner A-176 Jackson L-14
Johnson A-273 Curry L-93
Willians
Jones A-472 Smith L-11 Curry
Lindsay A-284 Williams L-17

∏ CUSTOMER_NAME (BORROW) - ∏ CUSTOMER_NAME (DEPOSITOR)
6. Cartesian product
The Cartesian product is used to combine each row in one table with each row in the
other table. It is also known as a cross product.
It is denoted by X (cross).
Notation: E X D  
EMPLOYEE DEPARTMENT
EMP_ID EMP_NAME EMP_DEPT
DEPT_NO DEPT_NAME
1 Smith A
A Marketing
2 Harry C
B Sales
3 John B
C Legal

Input: EMPLOYEE X DEPARTMENT  
Output: EMP_ID EMP_NAME EMP_DEPT DEPT_NO DEPT_NAME
1 Smith A A Marketing
1 Smith A B Sales
1 Smith A C Legal
2 Harry C A Marketing
2 Harry C B Sales
2 Harry C C Legal
3 John B A Marketing
3 John B B Sales
3 John B C Legal
7. Rename Operation:
The rename operation is used to rename the output
relation. It is denoted by rho (ρ).
Example: We can use the rename operator to rename
STUDENT relation to STUDENT1.

ρ(STUDENT1, STUDENT)  
Entity Relationship (ER) Model
The ER or (Entity Relational Model) is a high-level
conceptual data model diagram. Entity-Relation model
is based on the notion of real-world entities and the
relationship between them.

ER modelling helps you to analyse data requirements


systematically to produce a well-designed database.
So, it is considered a best practice to complete ER
modelling before implementing your database.
Entity
An Entity may be a real world object with a physical
existence – a particular person, car, house, or employee
– or it may be an object with a conceptual existence – a
job, or a university course.

Entities are represented by means of rectangles.


Entity Set
An Entity is an object of Entity Type and set of all
entities is called as entity set. e.g.; E1 is an entity having
Entity Type Student and set of all students is called
Entity Set. In ER diagram, Entity Type is represented as:
Types of Entity
Strong Entity
Weak Entity
Attribute
An Attribute is a property or characteristics of an entity. Attributes are
represented by means of ellipses. All entities in an entity set have same set
of attributes.

Examples of Attributes
Employee – empname, emp_no, emp_sal etc.
Student – stu_id, student_name, course, etc.

Every ellipse represents one attribute and is directly connected to its


entity (rectangle).
Types of Attributes-
Simple attributes.
Composite attributes.
Single valued attributes.
Multi valued attributes.
Derived attributes.
Key attributes
Simple attribute − Simple attributes are, which cannot be divided further.
For example, a student's rollno, class, age and phone number.

Composite Attribute-If the attributes are composite, they are further divided into
many another simple attributes. That is, composite attributes are represented by
ellipses that are connected with an ellipse.
Single Valued Attributes- Single valued attributes are those attributes which can
take only one value for a given entity from an entity set. 

Multi Valued Attributes- Multi valued attributes are those attributes which can
take more than one value for a given entity from an entity set.
Derived Attributes- Derived attributes are those attributes which can be
derived from other attribute.

Key Attributes- Key attributes are those attributes which can identify an
entity uniquely in an entity set.
In the above example roll_no is key attribute.
Relationship
A relationship is represented by diamond shape in ER diagram, it shows the
relationship among entities. There are four types of relationships:
1. One to One
2. One to Many
3. Many to One
4. Many to Many
1. One to One Relationship
When a single instance of an entity is associated with a single instance of another
entity then it is called one to one (1:1) relationship. For example, a person has only one
passport and a passport is given to one person.
2. One to Many Relationship
When a single instance of an entity is associated with more than one instances of another
entity then it is called one to many (1:N) relationship. For example – a customer can place
many orders but a order cannot be placed by many customers.

3. Many to One Relationship


When more than one instances of an entity is associated with a single instance of another
entity then it is called many to one relationship. For example – many students can study in
a single college but a student cannot study in many colleges at the same time.

4. Many to Many Relationship


When more than one instances of an entity is associated with more than one instances of
another entity then it is called many to many relationship. For example, a can be assigned
to many projects and a project can be assigned
Oracle 10g: User name: system or scott
Oracle 8e: scott / tiger
Steps to open oracle sql:
Start  all pro  oracle 10g ex  SQL command Prompt

Or
In search just sql

1. Connect DB server :
connect
username: system/scott (name given at the time of instalation )
password: system (default)

You might also like