0% found this document useful (0 votes)
17 views

Database Design and Development

This document provides an overview of database design and development, focusing on concepts, components, and the importance of databases in managing data. It covers various database models, including hierarchical, network, entity-relationship, and relational models, as well as the functionalities of Database Management Systems (DBMS). Additionally, it discusses the significance of data integrity, security, and the role of ER diagrams in visualizing database structures.

Uploaded by

geethagini
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)
17 views

Database Design and Development

This document provides an overview of database design and development, focusing on concepts, components, and the importance of databases in managing data. It covers various database models, including hierarchical, network, entity-relationship, and relational models, as well as the functionalities of Database Management Systems (DBMS). Additionally, it discusses the significance of data integrity, security, and the role of ER diagrams in visualizing database structures.

Uploaded by

geethagini
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/ 74

Database Design and

Development
Objective
• This Unit aims to provide learners an understanding of the
concept of databases, its objects, principles, application.
• The unit furthermore will provide the necessary skills and
knowledge in designing a logical database and implementing a
physical database using the industry accepted technologies.
Learning Outcomes
• On successful completion of this module, students should be
able to:
• Explain the database concepts and components
• Develop logical database design.
• Construct a physical database for a given requirement
• Test and Manage databases
Data Vs Information
1.Data:
• Data refers to raw facts, figures, or symbols that do not carry
any specific meaning by themselves.
• It consists of individual pieces of information.
• Data can be in various forms, such as numbers, text, dates,
images, or any other format.
• Example data elements:
• 12345
• John Smith
• 2023-10-21
• 12.5cm
2. Information:
• Information is data that has been processed, organized, or
interpreted to give it meaning and context.
• It provides knowledge, insights, or answers to specific
questions.
• Information is the result of analyzing and deriving meaning
from data.
• Example information:
• "Customer John Smith with ID 12345 made a purchase of
$12.50 on 2023-10-21.“
• Databases are designed to store and manage data.
• The process of transforming data into information often involves
querying the database and using various operations like filtering,
sorting, and aggregation to extract meaningful insights and
answers.
• A database is an organized collection of structured information,
or data, typically stored electronically in a computer system.
• A database is usually controlled by a database management
system (DBMS)
Database
• A database is a structured

collection of data.

• That is organized, stored,

and managed in a way that

allows for efficient retrieval,

updating, and processing of

that data.
• Key characteristics and components of a database
include:
1. Data:
• Databases store a wide range of data, including numbers,
text, dates, images, and more.
• This data is organized into tables with rows and columns.
2. Tables:
• In a database, data is typically organized into tables, which
consist of rows (records) and columns (fields).
• Each row represents a specific record or entry, while each
column represents a specific attribute or field of data.
3. Schemas:
• Databases use a schema to define the structure of the
database, including the tables, fields, relationships
between tables, and constraints on the data.
4. Queries:
• Users can retrieve and manipulate data in a database using
queries.
• SQL (Structured Query Language) is a common language
used to interact with relational databases.
5. Relationships:
• Databases can establish relationships between tables to
link related data.
• For example, in a customer database, there might be a
relationship between customers and their orders.
6. Indexes:
• Databases often use indexes to improve the speed of data
retrieval.
• An index is a data structure that provides quick access to
data rows.
7. Security:
• Databases have security features to control who can
access, modify, and delete data.
• Access control and authentication mechanisms are used to
safeguard the data.

8. ACID Properties:
• Databases adhere to ACID properties (Atomicity,
Consistency, Isolation, Durability) to ensure data integrity
and reliability, especially in multi-user environments.

9. Scalability:
• Databases can be designed to scale to handle large
volumes of data and concurrent users.
Why we need Database?
• Allows a business to make informed business decisions.
• Efficiently store and retrieve related information.
• Helps analyze and aggravate business data.
• Collect and store crucial customer data from different applications.
• Delivers data-driven timely, personalized applications and detailed
analytics.
• Ensures immediate access to crucial business data that different
departments can use to comprehend data patterns, generate reports,
and predict future trends.
Database Models
• A Database model defines the logical design and structure of a database.
• It defines how data will be stored, accessed, and updated in a database
management system.
• There are several types of database models, each with its own characteristics
and purposes. For example
• Hierarchical model
• Network Model
• Relational Model
• Entity-Relationship Model
Hierarchical Model
Hierarchical Model
• In a hierarchical model, data is organized in a tree-like structure, with parent-
child relationships.
• Each record can have multiple child records but only one parent record.
• This model is commonly used in older database systems, such as IBM's
Information Management System (IMS).
Network Model
Network Model
• The network model is an extension of the hierarchical model that allows records
to have multiple parent and child records.
• In the network database model, data is more related as more relationships are
established in this database model.
• It's more flexible than the hierarchical model but can be complex to implement
and use.
• This was the most widely used database model before Relational Model was
introduced.
Entity-Relationship Model
Entity-Relationship Model
• The ER model is a conceptual model used for database design.
• It represents entities (objects or concepts) and the relationships between them.
Attributes of entities are also defined.
• The ER model helps in the visualization and design of a database schema.
• ER Models are defined to represent the relationships in pictorial form to make it
easier for different stakeholders to understand.
• This model is good to design a database, which can then be turned into tables in
a relational model.
Relational Model
Relational Model / Record-based Model
• The relational model is the most widely used database model.
• It represents data as tables (relations) with rows (tuples) and columns
(attributes).
• Relationships between tables are established through keys.
• You can design tables, normalize them to reduce data redundancy, and use
Structured Query language or SQL to access data from the tables
• SQL (Structured Query Language) is commonly used to manage and query
relational databases.
Relational Model
Characteristics of Relational Model
• Each relation in a database must have a distinct or unique name which would
separate it from the other relations in a database.
• A relation must not have two attributes with the same name. Each attribute
must have a distinct name.
• Duplicate tuples must not be present in a relation.
• Each tuple must have exactly one data value for an attribute.
• Tuples in a relation do not have to follow a significant order as the relation is
not order-sensitive.
• Similarly, the attributes of a relation also do not have to follow certain
ordering, it’s up to the developer to decide the ordering of attributes.
Types of Database
Types Of Database
• There are several major types of databases, each designed to serve different
needs and applications. Here are the most common types of databases:

1. Relational Databases (RDB):


• Relational databases are structured databases that use a tabular schema to
organize data into rows and columns.
• They are based on the principles of the relational model, where data is
stored in tables and relationships are established between tables.
• Popular relational database management systems (RDBMS) include
MySQL, PostgreSQL, Oracle Database, Microsoft SQL Server, and
SQLite.
2. NoSQL Databases:
• NoSQL databases are non-relational databases designed to handle large
volumes of unstructured or semi-structured data.
• They offer more flexibility in terms of data modeling and can be used for
various purposes, including document stores, key-value stores, column-
family stores, and graph databases.
• Examples of NoSQL databases include MongoDB, Cassandra, Redis, and
Neo4j.
Specialized Database Types
Database Management System(DBMS)
Database Management System(DBMS)
• A Database Management System (DBMS) is software that manages, stores,
retrieves, and organizes data in a database.
• It serves as an interface between the database and the application programs or
users who need to access the data.
• DBMS software is designed to efficiently and securely handle various data-
related operations, ensuring data integrity, security, and ease of use.
• DBMSs are used in various applications and industries, including e-commerce,
healthcare, finance, education, and more.
Database Management System(DBMS)
• Common examples of Database Management Systems include:
• MySQL
• Oracle Database
• Microsoft SQL Server
• PostgreSQL
• SQLite
• IBM Db2
• MongoDB (a NoSQL DBMS)
• Key functions and components of a Database Management System include:
• Data Storage:
• A DBMS manages the physical storage of data, storing it in files or tables on
storage devices like hard drives.
• It handles the allocation, indexing, and management of data to optimize access
and retrieval.
• Data Retrieval:
• DBMS provides mechanisms to retrieve data from the database, typically using
structured query languages (SQL) for defining and executing queries.
• Data Manipulation:
• DBMS allows users and applications to insert, update, and delete data in the
database. It enforces data integrity constraints to maintain data consistency.
• Data Security:
• DBMS provides security features to control user access to data, including user
authentication, authorization, and encryption.
• It ensures that data is protected from unauthorized access.
• Data Concurrency Control:
• DBMS manages concurrent access to the database by multiple users or applications.
• It employs locking and transaction management to prevent data conflicts and
maintain data consistency.
• Data Recovery and Backup:
• DBMS systems include mechanisms for data backup and recovery, allowing the
restoration of data in case of system failures, crashes, or data corruption.
• Data Modeling:
• DBMS helps in data modeling by providing tools to define the structure and
relationships between data elements.
• This includes creating tables, defining columns, and specifying keys and indexes.
• Query Optimization:
• DBMS optimizes queries for efficient data retrieval.
• It uses query optimization techniques to select the most efficient execution plan for a
given query, improving performance.
• Data Integrity and Constraints:
• DBMS enforces data integrity through constraints, ensuring that data adheres to
predefined rules, such as uniqueness, referential integrity, and data type consistency.
• Backup and Recovery:
• DBMS includes features for data backup and recovery, which are essential for
protecting data from loss or corruption.
• Scalability and Performance:
• Modern DBMS systems are designed to be scalable, allowing them to handle
growing data volumes and increased user loads while maintaining performance.
Relational Database Management System(RDBMS)
• A relational database is a type of database management system (DBMS) that
uses a relational model to store and manage data.

• In this model, data is organized into tables with rows and columns, and
relationships between tables are defined by keys.

• Relational databases are one of the most widely used database systems and have
been a cornerstone of data storage and management for several decades.

• Relational databases are widely used in various applications, such as e-


commerce systems, content management systems, customer relationship
management (CRM) software, financial applications, and more.
• Common examples of relational database management systems include:
• MySQL:
• An open-source relational database management system known for its speed, ease
of use, and wide adoption.
• PostgreSQL:
• An open-source RDBMS that is highly extensible and supports advanced features,
including geospatial data.
• Oracle Database:
• A commercial RDBMS known for its robustness, scalability, and use in enterprise-
level applications.
• Microsoft SQL Server:
• A commercial RDBMS designed for Windows environments, widely used in
businesses.
• Activity :
Compare the Relational Database Management System with Non-Relational
Database Management System.
Entity Relationship Diagram
(ER Diagram)
• An Entity-Relationship (ER) diagram is a visual representation used in database
design to describe the logical structure of a database.
• It illustrates the entities (such as objects, concepts, or things), their attributes
(characteristics or properties), and the relationships between entities within the
database system.
ER Diagram
• ER diagrams serve as a visual tool during the database design phase, aiding in:
• Providing a high-level view of the database structure.
• Identifying entities and their relationships.
• Reducing data redundancy and improving data integrity through
normalization.
• Communicating the database structure to stakeholders, including developers,
designers, and end-users.
• These diagrams are crucial in database design, helping to establish the blueprint
for a database system and ensuring a common understanding of the data structure
and relationships within the system.
ER Diagram Components
Entity
• Objects or things in the real world that are distinguishable and identifiable.
• They can be physical objects (like a car or a person) or conceptual entities (like an
order or a transaction).
• Entities are represented as tables in a database.
Attributes
• Characteristics or properties that describe an entity.
• They are the specific details or features that define an entity.
• Each attribute corresponds to a field in a database table and holds a specific type
of data (e.g., name, age, address).
1. List the properties of each table.
2. Identify the primary key in each table.
3. Are there any candidate keys in either table?
4. Identify the foreign key in the Book Orders table.
5. Do the tables contain redundant data? If so which table(s) and
what is the redundant data?
Relationships
• Describes the connections and associations between entities in a database.
• Specifies how entities interact with each other.
• Structural constraints in relationships within an ER diagram are crucial for
designing a well-defined, normalized database model.
• Key structural constraints for relationships in an ER diagram include
• Cardinality Ratios
• Participation Constraints.
Cardinality Ratios
• These constraints specify the number of instances of one entity that
can be associated with a single instance of another entity in a
relationship.
• The cardinality can be one-to-one (1:1), one-to-many (1:N), or
many-to-many (M:N).
Participation Constraints
• Participation Constraints define that the participation in a
relationship can either be total or partial.
ER
Diagra
m
Symbol
s
ER
Diagram
Activity01:
1. List the Non-weak entity types in the ER-Diagram?
2. Is there a weak entity type? If-so give its name , partial key and
identifying relationship?
3. What constraints do the partial key and the identifying relationship
of the weak entity type specify in this program?
4. List the names of all relationship types, and specify the (min, max)
constraint on each participation of an entity type in a relationship
types?
5. List briefly the user requirements that led to this ER Schema
design.
Activity02:
Activity03:
Schema Diagram
• A schema diagram is a visual representation of a database schema.
• A schema diagram is used to illustrate and document this structure, making it
easier to understand and communicate the design of a database.
• Schema diagrams are an important tool for database designers, developers, and
administrators.
• It helps visualize the structure of the database, plan for data storage and retrieval,
and ensure that the database design meets the requirements of the application it
serves.
Schema Diagram
Activity:
Differentiate the Database schema and Database model
Functional Dependency
• In RDBMS, a functional dependency is a relationship between
two sets of attributes in a relation (table).
• It describes how one set of attributes uniquely determines another
set of attributes.
• A functional dependency is denoted by an arrow (->) and is
typically written as X -> Y, where X and Y are sets of attributes.
• This notation signifies that knowing the values of X uniquely
determines the values of Y.
Types of Functional Dependency
• Full Functional Dependency
• Removing any attribute from the determinant will break the
dependency.
• For example, if A, B, and C are attributes and A, B -> C is a
complete functional dependency, removing either A or B from the
determinant will no longer determine C.
• Partial Functional Dependency
• A type of dependency where an attribute is dependent on only a
part (a subset) of a composite primary key.
• For example, if (A, B) is the composite primary key and A -> C, it
represents a partial dependency.

• Transitive Functional Dependency:


• A dependency in which one attribute functionally determines
another through a third attribute.
• If A -> B and B -> C, then A -> C is a transitive functional
dependency.
Properties of Functional Dependency
1.Reflexivity:
• Every set of attributes is functionally dependent on itself.
• If X is a set of attributes, then X → X holds.

2.Augmentation:
• If X → Y holds, then adding attributes to both sides preserves the functional
dependency.
• If X → Y, then XZ → YZ.

3.Transitivity:
• If X → Y and Y → Z hold, then it implies that X → Z.
• The dependency can be transitive through a common set of attributes.
4. Splitting:
• If X → YZ holds, then it implies both X → Y and X → Z.
• The dependency can be split into multiple dependencies.

5. Combining:
• If X → Y and X → Z hold, then it implies X → YZ.
• The dependencies can be combined into a single dependency.
Inference Rule
1.Reflexivity (Reflexive Rule):
• If Y is a subset of X, then X → Y.
2.Augmentation (Augmentative Rule):
• If X → Y, then XZ → YZ for any set of attributes Z.
3.Transitivity (Transitive Rule):
• If X → Y and Y → Z, then X → Z.
4.Union (Union Rule):
• If X → Y and X → Z, then X → YZ.
5. Decomposition (Decomposition Rule):
• If X → YZ, then X → Y and X → Z.
6. Pseudo transitivity:
• If X → Y and WY → Z, then WX → Z.
7. Combining (Combining Rule):
• If X → Y and X → Z, then X → YZ.
8. Remove Redundant Attributes (Irreducible Rule):
• If X → YZ and Y → W, then X → WZ.
Closure of an attribute
• The closure of a set of attributes refers to the complete set of
attributes that can be functionally determined by that original set,
based on a given set of functional dependencies.

• The closure of a set of attributes is denoted by adding a plus sign


(e.g., X+) .
Finding the keys using closure
• Super Key :
• If the closure result of an attribute set contains all the attributes
of the relation, then that attribute set is called as a super key of
that relation.
• The closure of a super key is the entire relation schema.
Finding the keys using closure
• Candidate Key :
• If there exists no subset of an attribute set whose closure contains
all the attributes of the relation, then that attribute set is called as
a candidate key of that relation.
Normalization
• Normalization is the process of organizing data in a relational
database to reduce redundancy and dependency.
• The goal of normalization is to
• Ensure data integrity
• Eliminate data anomalies
• Promote efficient data storage and retrieval
Normalization
• The normalization process is typically carried out through a series
of steps, each representing a normalization form.
• First Normal Form (1NF)
• Ensures that each column in a table contains atomic
(indivisible) values.
• There should be no repeating groups or arrays, and each cell
should have a single, atomic value.

• Second Normal Form (2NF)


• Builds on 1NF and requires that each non-prime attribute
(column) is fully functionally dependent on the entire
candidate key.
• No non-prime attribute should be partially dependent on
Candidate Key.
• This eliminates partial dependencies where some non-prime
attributes depend on only a portion of the candidate key.
• Third Normal Form (3NF)
• Extends 2NF by eliminating transitive dependencies.
• In 3NF, no non-prime attribute should depend on another
non-prime attribute.
• Each non-prime attribute should be directly dependent on the
candidate key.
• Boyce Code Normal Form (BCNF)
• A stricter form of normalization that addresses certain
anomalies not handled by 3NF.
• In BCNF, a table is in 3NF, and, additionally, for every
functional dependency (X -> Y), X must be a super key.
Summary
1.First Normal Form (1NF):
1. Eliminate duplicate rows.
2. Each column must contain atomic (indivisible) values.
3. The order in which data is stored does not matter.
2.Second Normal Form (2NF):
1. It must be in 1NF.
2. All non-prime attributes (columns) must be fully functionally
dependent on the entire primary key/candidate key.
3.Third Normal Form (3NF):
1. It must be in 2NF.
2. No transitive dependencies should exist. In other words, no non-
prime attribute (non-key attribute) should depend on another
non-prime attribute.
1. Given a relation R( A, B, C, D) and Functional Dependency set
FD = { AB → CD, B → C }, determine whether the given R is in
2NF? If not convert it into 2 NF.

2. Given a relation R( P, Q, R, S, T) and Functional Dependency set


FD = { PQ → R, S → T }, determine whether the given R is in
2NF? If not convert it into 2 NF.

3. Given a relation R( X, Y, Z) and Functional Dependency set FD =


{ X → Y and Y → Z }, determine whether the given R is in 3NF?
If not convert it into 3 NF.

4. Given a relation R( X, Y, Z, W, P) and Functional Dependency set


FD = { X → Y, Y → P, and Z → W}, determine whether the given
R is in 3NF? If not convert it into 3 NF.

You might also like