0% found this document useful (0 votes)
117 views13 pages

Database Mid Term

Uploaded by

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

Database Mid Term

Uploaded by

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

ENG/YOUSSEF ZAYED

DATABASE

2025
❖ Basic Concepts
o In computing, data is translating information into an efficient form as known facts to be processed, recorded, and
stored by a computer system.
o This information may have the form of text documents, images, audio, or other data types.
o In other words, information is data that has been processed into an implicit meaningful form, e.g., Student Information.
o A database is an organized collection of related sets of data that are managed to enable the user to view the
complete collection or any logical subset of the
o collection as a single unit.
o Database Management System (DBMS) is a software package/system to create and maintain a computerized database.
o A database system is considered as a computerized record-keeping system, including the DBMS software and the
data itself.
❖ The database is a kind of repository for collecting computerized data files and allow users to perform a variety of
operations, such as:
1. adding new files to the database
2. inserting data into existing files
3. retrieving data from existing files
4. changing data in existing
5. deleting data in existing files
6. removing existing files from the database
❖ Application Areas of DBMS

Airines For reservations and schedule information


Banking: For customer information, accounts loans, and banking transactions.
Universities For student information, course registrations, and grades.
Credit card transactions For purchases on credit cards and generation of monthly statements.
Telecommunications For keeping records of calls, generating monthly bills, maintaining balances on prepaid
calling cards, and storing information about the communication networks.
Sales For customer, product, and purchase information
Manufacturing For management of supply chain and for tracking production of items in factories,
inventories of items in warehouses/stores, and orders for items
Human Resources For information about employees, salaries, payroll taxes, and benefits, and for generation of paychecks.
Web-based services For taking web users' feedback, responses, resource sharing, etc.
❖ Examples of DBMS
• MySQL is one of the largest open-source companies in the world and is popular due to its high level of efficiency,
reliability, and cost
• MS-Access: It was developed by Microsoft and this computer-based application is used to form as well as create
databases on the desktop of the computers. It can be used for personal work and for small-scale businesses that
require a database
• Oracle database: It is the fourth relational database management system which is developed by Oracle
Corporation. Oracle database is useful for storing a large amount of data, especially by large organizations
• Microsoft SQL Server: It is an RDBMS from Microsoft which creates computer databases for MS-Windows. Based
on customer’s requirements, Microsoft has developed various versions of SQL Server.

Define a database in terms of data types, structures, and constraints


Construct or Load the Database on a secondary storage medium
Manipulating the database Manipulating the database: querying, generating reports, insertions, deletions,
and modifications to its content.
Concurrent Processing and by a set of users and programs while keeping the data's validity and consistency
Sharing
• Other features:
1. Protection or Security measures to prevent unauthorized access.
2. Active processing to take internal actions on data.
3. Presentation and Visualization of data.
❖ University Database Example
• Mini-world are some parts of the real world in which data is stored in a database.
• Mini-world for the example is part of the UNIVERSITY environment.

Some mini-world entities Some mini-world relationships


1. STUDENTs 1) SECTIONs are of specific COURSEs
2. COURSES 2) STUDENTs take SECTIONs
3. SECTIONs (of COURSEs) 3) COURSEs have prerequisite COURSEs
4. (academic) DEPARTMENTs 4) INSTRUCTORs teach SECTIONs
5. INSTRUCTORS 5) COURSEs are offered by DEPARTMENTs
6) STUDENTs major in DEPARTMENTs
❖ Database Characteristics
• Self-describing nature of a database system:
o A DBMS catalog stores the description of the database.
o This description is called meta-data, which allows the DBMS software to work with different databases.
• Insulation between programs and data:
o Called program-data independence, this allows changing data storage structures and operations without
having to change the DBMS access programs.
• Data Abstraction
o A data model is used to hide storage details and present the users with a conceptual view of the database.
• Support of multiple views of the data
o Each user may see a different view of the database, which describes only the data of interest to that user.
• Sharing of data and multiuser transaction processing
o Allowing a set of concurrent users to retrieve and to update the database.
o Concurrency control within the DBMS guarantees that each transaction is correctly executed or completely
aborted.
o (OLTP)Online Transaction Processing is a major part of database applications.
❖ Traditional File Systems
• Before the existence of computer:
o The manual file system was used to maintain the data and records.
o Files were used to store the data and it also makes it easier to find any sort of information from the files.
• To overcome the problems of the manual file system:
o Traditional File System was introduced which was entirely a computer-based system where all information
were stored in different files on the computer.
o It also stores the whole data in a manner that it becomes easy for the departments of the large industries
have their different files, but it forms redundancy of the data.
• Advantages:
o Simple functionality that fits the needs of small businesses and home users
o Less expensive
• Disadvantages:
o Does not support multi-User access
o Limited to small organizations
o Limited functionality (i.e. no support for complicated transactions , recovery, etc).
o Decentralization of data
o Redundancy and Integrity issues
❖ Database Approach
• All data is stored in a single database.
• The database will be physically stored in a set of files, but users and applications do not need to know anything
about the physical storage.
• Relationships between sets of data are represented in the database.
• The description of database, including relationships is stored with actual data; this to enable the database
management system (DBMS) to retrieve information from the database and to store new data in the database.
• The applications do not directly access the database; instead, they pass requests to the DBMS to retrieve or
store data.
❖ Traditional File Approach VS. Database Approach
• In simple terms, a File Management System (FMS) is a Database Management System that allows access to
single files or tables at a time.
• FMS’s accommodate flat files that have no relation to other files.
• The FMS was the predecessor for the Database Management System (DBMS), which allows access to multiple
files or tables at a time
❖ Advantages of Using DBMS

Efficient Data Access where variety of techniques are used to store and retrieve data.
Data integrity we can ensure data integrity if the data is always enforced through integrity
constraint
Data administration deals with the modeling of the data and treats data as an organizational resource.
Concurrent Access and crash ensures concurrent access of the data in such a way that the data is being
recovery accessed by only one user a time. Also protects the system from crashes.
Reduced Application supports all the important functions that are common to many applications.
Development time
Controlling redundancy in data storage and in development and maintenance efforts.
Sharing of data among multiple users.
Restricting unauthorized access to data.
Providing Storage Structures for efficient Query Processing
Data independence provides an abstract view of the data that hides the details data representation
and storage.
❖ Database Users
• Actors on the Scene: those who use and control the content, and
• Workers Behind the Scene: those who enable the database to be developed and the DBMS software to be
designed and implemented.
❖ Database Users - Actors on the scene
• Database administrator: responsible for authorizing access to the database, for coordinating and monitoring its
use, acquiring software, and hardware resources, controlling its use and monitoring efficiency of operations.
• Database Designers: responsible for defining the content, the structure, the constraints, and functions or
transactions against the database. They must communicate with the end-users and understand their needs.
• End-users: they use the data for queries, reports and some of them update the database content.
❖ Categories of End-users
• Casual: access database occasionally when needed.
• Naïve or Parametric: they are most of the end-user population. They use previously well-defined functions in
the form of “canned transactions” against the database. For examples: bank-tellers or reservation clerks.
• Sophisticated: these include business analysts, scientists, engineers, and others who are familiar with the
system capabilities.
• Stand-alone: mostly maintain personal databases using ready-to-use packaged applications. An example is a tax
program user that creates his or her own *internal database.
❖ When Not To Use a DBMS System
1) It requires high investment.
2) The requirement of DBMS is not a necessity.
3) The access to the multi-user is not provided.
4) If the database is not efficient to handle the complexities of the data.
5) When it does not fulfil the real-time requirements for some application
6) programs due to the overhead embedded systems.
7) When it increases the data redundancy.
8) If it does not provide the security and privacy to the data which is required.
❖ Data Models, Schemas , and Instances
• Data Model: A set of concepts to describe
o the structure of a database,
o the operations for manipulating these structures, and
o the constraints that the database should obey.
• Data Model provides proper means to describe the design of a database at the
▹Physical level ▹Logical level ▹View levels
• Data Model Structure
o data and data types and entities (e.g., record, table(
o relationships among data
o constraints on data
Each department must have at least 5 employees
A student cannot have more than one advisor
The salary of employee cannot exceed the salary of his/her immediate supervisors
• Data Model Operations: are for specifying database retrievals and updates by referring to the concepts of the
data model and may include:
o basic operations, e.g., generic insert, delete, update
o user-defined operations, e.g., compute student GPA, update inventory.
• Categories of Data Models
o Conceptual (high-level, semantic) data models: Describe the database at a very high level to understand
the database requirements within the requirements gathering process (e.g., Entity/relationship model or
ER model(
o Physical (low-level, internal) data models: Provide concepts that describe details of how data is stored in
the computer.
o Implementation (representational) data models: Represent only the logical part of the database to allow
focusing on the design part of the database (e.g., Relational model(
❖ History of Data Models
o Hierarchical Data Model: is the oldest type of the data model.
▪ It was developed in a joint effort by IBM and North American Rockwell around .1965
▪ It organizes data in the tree- like structure.
▪ ADVANTAGES
Hierarchical Model is simple to construct and operate on.
Corresponds to several natural hierarchically organized domains (e.g., assemblies in manufacturing,
personnel organization in companies(
Language is simple; uses constructs like GET, GET UNIQUE, GET NEXT, GET NEXT WITHIN PARENT etc.
▪ DISADVANTAGES
Navigational and procedural nature of processing.
Database is visualized as a linear arrangement of records.
Little scope for "query optimization
o Network Data Model: is the advance version of the hierarchical data model.
▪ To organize data it uses directed graphs instead of the tree-structure.
▪ In this child can have more than one parent.
▪ It uses the concept of the two data structures i.e. Records and Sets.
▪ ADVANTAGES
Network Model can model complex relationships and represents semantics of add/delete on the
relationships.
Can handle most situations for modeling using record types and relationship types.
Language is navigational; uses constructs like FIND, FIND member, FIND owner, FIND NEXT within set,
GET etc. Programmers can do optimal navigation through the database.
▪ DISADVANTAGES
Navigational and procedural nature of processing
Database contains a complex array of pointers that thread through a set of records.
Little scope for automated "query optimization”
o Relational Data Model:
▪ was developed by E.F. Codd in .1970
▪ There are no physical links as in the hierarchical data model.
▪ Example of several commercial products (DB2, ORACLE, SQL Server, SYBASE, INFORMIX (
o Object-Oriented Data Model
▪ is a developed data model that comprise models of persistent O-O Programming Languages.
▪ This model can store audio, video, and graphics files.
▪ is a combination of an object-oriented data model and a relational data model.
▪ It supports objects, classes, inheritance etc. just like O-O models and has support for data types, tabular
structures etc. like Relational data model.
▪ One of the major goals of Object relational data model is to close the gap between relational databases
and the object- oriented practices used in many programming languages such as C++, C#, Java etc.
❖ Schemas versus Instances
• Database Schema: The description of a database. Includes descriptions of the database structure and the
constraints that should hold on the database.
• Schema Diagram: A diagrammatic display of (some aspects of) a database schema.
• Schema Construct: A component of the schema or an object within the schema, e.g., STUDENT, COURSE.
• Database Instance: The actual data stored in a database at a particular moment in time Also called database
state (or occurrence(
❖ Database Schema Vs. Database State
• Database State: Refers to the content of a ▸database at a moment in time
• Initial Database State: Refers to the database ▹ when it is loaded
• Valid State: A state that satisfies the structure ▹and constraints of the database
• Distinctions
o The database schema changes very infrequently while the database state changes every time the database is updated
o Schema is also called intension, whereas state is called extension
❖ Three-Schema Architecture
➢ Proposed to support DBMS characteristics of:
• Self-describing nature of DBMS
• Program-data independence.
• Support of multiple views of the data.
➢ Not explicitly used in commercial DBMS
• products, but has been useful in explaining database system organization
External schemas at the external level to describe the various user views. Usually uses the same data model
as the conceptual level.
Conceptual schema at the conceptual level to describe the structure and constraints for the whole database
for a community of users. Uses a conceptual or an implementation data model.
Internal schema at the internal level to describe physical storage structures and access paths. Typically uses
a physical data model.
➢ Mappings among schema levels are needed to transform requests and data.
• Programs refer to an external schema are mapped translated by the DBMS to the internal schema for execution.
• Data extracted from the internal DBMS level is reformatted to match the user’s external view.
o E.g., formatting the results of an SQL query for display in a Web page
❖ Data Independence
➢ Three-schema architecture is used to achieve data independence
• changing schema at one level without changing the schema at the next higher level
o When a schema at a lower level is changed, only the mappings between this schema and higher-level
schemas need to be changed in a DBMS that fully supports data independence.
o The higher-level schemas themselves are unchanged.
o Hence, the application programs need not be changed since they refer to the external schemas.
➢ Logical Data Independence: The capacity to change the conceptual schema without having to change the
external schemas and their application programs.
o E.g., view should not be changed if the base tables are changed.
➢ Physical Data Independence: The capacity to change the internal Schema without having to change the
conceptual schema for example:
o the internal schema may be changed whenever certain file structures are reorganized or
o new indexes are created to improve database performance.
❖ DBMS Languages
➢ Data Definition Language (DDL) is used by the DBA and database designers to specify the conceptual schema
of a database.
o In many DBMSs, the DDL is also used to define internal and external schemas (views)
➢ Storage Definition Language (SDL) is typically realized via DBMS commands provided to the DBA and database
designers
➢ View Definition Language (VDL) are used to define internal and external schemas.
➢ Data Manipulation Language (DML)is used to specify database retrievals and updates.
o Retrieval of information
o Insertion of new information
o Deletion and/or modification of information stored in the D
➢ Two main types DMLs
o Low level (procedural): DML commands (data sublanguage) can be embedded in a general-purpose
programming language (host language), such as C or an Assembly Language.
o High-level (nonprocedural) DML: stand-alone DML commands can be applied directly (called a query
language).
➢ High Level or Non-procedural Languages: e.g., SQL, are set-oriented and specify what data to retrieve than how
to retrieve. Also called declarative languages.
➢ Low Level or Procedural Languages: record-at-a-time; they specify how to retrieve data and include constructs
such as looping.
❖ DBMS Interfaces
➢ Stand-alone query language interfaces.
➢ Programmer interfaces for embedding DML in programming languages:
o Pre-compiler Approach
o Procedure (Subroutine)Call Approach
➢ User-friendly interfaces:
o Menu-based, popular for browsing on the web
o Forms-based, designed for naïve users
o Graphics-based (Point and Click, Drag and Drop etc)
o Natural language: requests in written English
o Combinations of the above
➢ Other DBMS Interfaces
➢ Speech as Input and Output
➢ Web Browser as an interface
➢ Parametric interfaces (e.g., bank tellers) using function keys.
➢ Interfaces for the DBA:
o Creating accounts, granting authorizations
o Setting system parameters
o Changing schemas or access path
❖ Database System Utilities
➢ To perform certain functions such as:
o Loading:data stored in files into a database. Includes data conversion tools.
o Backing up :the database periodically on tape.
o Reorganizing database file structures.
o Report generation utilities.
o Performance monitoring utilities.
o Other functions, such as sorting, user monitoring, data compression, etc.
➢ Other Tools
o Data dictionary/repository:
▪ Used to store schema descriptions and other information such as design decisions,
▪ application program descriptions, user information, usage standards, etc.
▪ Active data dictionary is accessed by DBMS software and users/DBA.
▪ Passive data dictionary is accessed by users/DBA only.
o Application Development Environments and CASE (computer-aided software engineering) tools:
▪ Examples – Power builder (Sybase), Builder Borland
❖ Centralized and Client/Server Architecture
➢ Centralized DBMS: combines everything into single system including:
• DBMS software,
• hardware,
• application programs
• user interface processing software.
❖ Basic Client-Server Architectures
➢ The client/ server architecture was developed to deal with computer environment in which many PCs,
workstation, fileserver, etc.
➢ A client in this framework is typically a user machine that provides user interface capabilities and local
processing
➢ A server is a system containing both hardware and software that can provide services to the client machines
➢ The DBMS client/server architecture consists of:
• Specialized Servers with Specialized functions, such as:
o File Servers
o Printer Servers
o Web Servers
o E-mail Servers
• Clients
• DBMS Server
❖ Clients
➢ Provide appropriate interfaces and a client-version of the system to access and utilize the server resources.
➢ Connected to the servers via some form of a network (e.g., LAN: local area network, wireless network, etc (
❖ DBMS Server
➢ Provides database query and transaction services to the clients
➢ Sometimes called query and transaction servers
❖ Two Tier Client-Server Architecture
➢ User Interface Programs and Application Programs run on the client side
➢ Interface called ODBC (Open Database Connectivity) provides an Application program interface (API) allow
client-side programs to call the DBMS.
➢ Most DBMS vendors provide ODBC drivers.
➢ Divided in to two parts:
• Client Tier: where requests are sent from the clients to the database.
• Data Tier: consists of the database, where requests are processed, and the data are sent back to the client.
➢ A client program may connect to several DBMSs.
➢ Other variations of clients are possible: e.g., in some DBMSs, more functionality is transferred to clients
including:
• data dictionary functions
• optimization and recovery across multiple servers, etc.
➢ In such situations the server may be called the Data Server.
❖ Three Tier Client-Server Architecture
➢ The emergence of the Web changed the roles of client and server, leading to the three-tier architecture which is
common for Web applications.
➢ Intermediate Layer or middle layer is sometimes called Application Server or Web Server:
• stores the web connectivity software and the rules and business logic (constraints) part of the application
used to access the right amount of data from the database server
• acts like a conduit for sending partially processed data between the database server and the client.
➢ Additional Features- Security:
• encrypt the data at the server before transmission
• decrypt data at the client
❖ Classification of DBMSs
➢ Based on the data model used:
• Traditional: Relational, Network, Hierarchical.
• Emerging: Object-oriented, Object-relational.
➢ Other classifications:
• Single-user (typically used with micro-computers e.g access ) vs. multi-user )most DBMSs sql (
• Centralized uses a single computer with one database) vs distributed (uses multiple computers, multiple
data bases(
➢ Distributed Database Systems are known as client-server-based database systems because they do not support a
totally distributed environment, but rather a set off database servers supporting a set of clients.
❖ Variations of Distributed Environments:
➢ Homogeneous: all the sites use identical DBMS and operating systems
• Autonomous: Each database is independent that functions on its own.
• Non- autonomous: Data is distributed across the homogeneous nodes and a central DBMSco-ordinates
data updates across the sites
➢ Heterogeneous: different sites have different operating systems, DBMS products and data models
• Federated: independent in nature and integrated together so that they function as a single database system
• Multi database: database systems employ a central coordinating module through which the databases are
accessed
❖ Overview of Database Design Process
➢ Database design process contains Two main activities:
• Database Design
o The focus in this presentation will be on the database design. Specifically, to design the conceptual
schema for a database application.
• Applications Design
o Applications design focuses on the programs and interfaces that access the database. Generally
considered part of software engineering.
❖ Using High-Level Conceptual Data Models
➢ Requirements Collection and Analysis
• Task: Database designers interview prospective database users to understand and document data
requirements
• Deliverables: Data requirements and Functional requirements of the application
➢ Conceptual Design
• Task: conceptual model design including the description of data requirements.
o Includes detailed descriptions of the entity types, relationships, and constraints.
o Transformed from high-level data model into implementation data model.
• Deliverables: Conceptual schema (Conceptual model) e.g.ER- Model.
➢ Logical Design or Data Model Mapping
• Task: Maps conceptual model to the implemented logical model of target DBMS.
• Deliverables: Logical schema )Logical model) e.g. Relational Schema.
• Remarks: What we need to do(focus) on in this phase: Integrity, Constraints, and Normalization.
➢ Physical Design Phase
• Task: Determines how a database is implemented in a DBMS. Internal storage structures, file organizations,
indexes, access paths, and physical design parameters for the database files specified.
• Deliverables: Internal Schema (Physical model) e.g. File organization, Indexes.
• Remarks: What we need to do(focus) on in this phase: Denormalization, Indexing, Derived data, Storage
structure, Partitioning, View, Security, Query Optimization, Backup, Recovery, Concurrency control, Access
control.
❖ Data Modeling
➢ Data modeling is the process of creating a model for the data to be stored in a specific format in a database (as
explained in the previous lecture)
➢ Data models identify what data is needed and how it should be organized to enable the creation of a database
that will be used to develop an app. They also ensure the quality of data via naming conventions and default
values
➢ Data models can serve a variety of purposes, from high-level conceptual and logical models to physical data
models (PDMs)
➢ There are three kinds of data models whose abstraction level are from high to low:
• Conceptual Model
o A data model that is independent of all implementation details like target DBMS, storage structure,
security, performance issue. Example: ER model.
• Logical Model
o A logical data model describes the data in as much detail as possible, without regard to how they will
be physical implemented in the DBMS. Examples: By ANSI -> Hierarchical Model, Network Model,
Relational Model and Object- Oriented Model.
• Physical Model
o Data model that involved data management technology.
➢ Data Modeling Techniques
• Data models’ creation implies using specific data modeling techniques.
• These are the two major data modeling techniques:
1) Entity Relationship Diagram (ERD)
2) UML (Unified Modeling Language)
3) Data Dictionary
❖ UML (Unified Modeling Language)
➢ UML (Unified Modeling Language) is a standardized family of notations for modeling and design of information
systems.
➢ UML is a generic data modeling language that standardizes the data, enabling the design of a system
➢ It comprises of several different diagrams representing different aspect of the system, and one of them being a
Class Diagram that can be used for data modeling.
• Class diagrams are equivalent of ERDs in relational world and are mostly used to design classes in object-
oriented programming languages (such as Java or C #).
➢ In class diagrams architects define:
• Classes (equivalent of entity in relational world) Attributes of a class (same as in an ERD) including data
type, Methods associated to specific class, representing its behavior.
• Relationships grouped into two categories:
o Relationships between objects (instances of Classes) differentiated into Dependency, Association,
Aggregation and Composition (equivalent to relationships in an ERD)
o Relationships between classes of two kinds Generalization/Inheritance and
Realization/Implementation (this has no equivalent in relational world.)
❖ Data Dictionary
➢ is an inventory of data sets/tables with the list of their attributes/columns
➢ Techniques mentioned above were visual and were based on diagrams, and data dictionaries are a tabular
definition/representation of data assets.
➢ Data dictionary is suitable as detailed specification of data assets and can be supplemented with ER diagrams, as
both serve slightly different purpose.
➢ Core data dictionary elements:
• List of data sets/tables,
• List of attributes/columns of each table with data type.
➢ Optional data dictionary elements:
• Item descriptions,
• Relationships between tables/columns,
• Additional constraints, such as uniqueness, default values, value constraints or calculated columns.
❖ Entity Relationship Diagram (ERD(
➢ Entity Relationship (ER) modeling is a best practice for producing well- designed databases.
• It depicts the structure of a relational databases allowing you to understand the data and how it shares
information.
➢ A high-level conceptual data model diagram which provides a visual representation of the data and how it is
interconnected.
➢ ERDs work well if you want to design a relational (classic) database. Basically, any kind of tabular data.
• ERD work well for visualization of database schemas and communication of top-level view of data.
❖ Entity Relationship (ER)Modeling
➢ The main concepts of an ER data model are:
➢ Entities – objects representing things from the real world. An entity is a collection of items having a common set
of attributes, and each item has a combination of attribute values.
1) Attributes – characteristics of properties of the entities.
2) Relationships – how entities are related one to another; how they share information in the DB.
❖ ER Model Concepts – Entities
➢ Entities are specific objects or things in the mini-world that are represented in the database
• For example the EMPLOYEE John Smith, the Research DEPARTMENT, the ProductX PROJECT.
➢ An entity may be :
• weak entity: is an entity that is existence-dependent on some other entity
• regular entity: is an entity that is not weak
➢ Each entity type is shown as a rectangle, labeled with the name of the entity type.
➢ For a weak entity type the rectangle is doubled
❖ ER Model Concepts – Attributes
➢ Attributes are properties used to describe an entity.
• For example, an EMPLOYEE entity may have a Name, SSN, Address, Sex, Birthdate.
➢ Specific Entity will have a Value for each of its attributes.
• For example, an EMPLOYEE entity may have a Name, SSN, Address, Sex, Birthdate.
➢ Each attribute has a Value Set (or data type) associated with it.
• E.g., integer, string, subrange, enumerated type , 24 …
➢ Types of Attributes
• Simple
o Each entity has a single atomic value for the attribute.
• Single-valued
o Single valued attributes are those attributes which can take only one value for a given entity from an entity set
• Composite
o The attribute may be composed of several components
• Multi-valued
o An entity may have multiple values for that attribute.
o Denoted as {Color}, {Mob−no}, {Email), or {Previous Degrees}.
• Derived
o Are those attributes which can be derived from other attribute (s)
❖ Entity Relationship Diagram (ERD)
➢ Entity Relationship (ER) modeling is a best practice for producing well- designed databases.
• It depicts the structure of a relational databases allowing you to understand the data and how it shares
information.
➢ A high-level conceptual data model diagram which provides a visual representation of the data and how it is
interconnected.
➢ ERDs work well if you want to design a relational (classic) database. Basically, any kind of tabular data.
➢ ERDs work well if you want to design a relational (classic) database. Basically, any kind of tabular data.
• ERD work well for visualization of database schemas and communication of top-level view of data.
❖ ER Model Concepts – Attributes
➢ Entities with the same basic attributes are grouped or typed into an Entity Type.
• For example, the EMPLOYEE entity type or the PROJECT entity type.
➢ An Attribute of an Entity Type for which each entity must have a unique value is called a key attribute of the
entity type.
• For example, SSN of EMPLOYEE or Roll No that can identify any STUDENT uniquely.
➢ Key Attribute
• Are those attributes which can identify an entity uniquely in an entity set.
• For example, the attribute Roll No is a key attribute as it can identify any student uniquely.
➢ A key attribute may be composite.
• For example, Vehicle Tag Number is a key of the CAR entity type with components (Number, State(.
➢ An entity type may have more than one key.
• For example, the CAR entity type may have two keys:
• Vehicle Identification Number (popularly called VIN), and
• Vehicle Tag Number (Number, State), also known as license Plate number
➢ In general, composite and multi-valued attributes may be nested arbitrarily to any number of levels although this is rare.
❖ ER Model Concepts - Relationships
➢ A relationship relates two or more distinct entities with a specific meaning.
➢ Relationships of the same type are grouped or typed into a Relationship Type.
➢ The Degree of a Relationship Type is the number of participating entity types.
• Both MANAGES and WORKS-ON are BINARY relationships.
➢ More than one relationship type can exist with the same participating entity types.
• For example, MANAGES and WORKS-FOR are distinct relationships between EMPLOYEE and DEPARTMENT
• but with different meanings and different relationship instances.
❖ Weak Entity Types
➢ An entity that does not have a key attribute
➢ A weak entity must participate in an identifying relationship type with an owner or identifying entity type
➢ Entities are identified by the combination of:
• A partial key of the weak entity type
• The particular entity they are related to in the identifying entity type
❖ Constraints on Relationships
➢ Constraints on Relationship Types (Also known as ratio constraints
• Maximum Cardinality
o One-to-one (1:1)
o One-to-many (1:N) or Many-to-one (N:1)
o Many-to-many
• Minimum Cardinality (also called participation constraint or existence dependency constraints)
o zero (optional participation, not existence- dependent (45)
o one or more (mandatory, existence-dependent)

You might also like