0% found this document useful (0 votes)
43 views10 pages

Dbms

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 10

Week 1

https://mariadb.com/kb/en/database-design-phase-2-conceptual-design/

https://condor.depaul.edu/gandrus/240IT/accesspages/relationships.htm

INTRODUCTION TO DATABASE MANAGEMENT SYSTEM

As the end user applications has changed significantly in last few decades, there is a challenge to store the large amount
of information, retrieve and manage this information in timely manner.

This can be achieving today by making use of services of Database Management System (DBMS).

The job of DBMS system is to collect the data, give a systematic representation to it and also provides ways for the data
to be modified or extracted by users or other programs.

(1) WHAT IS DATABASE MANAGEMENT SYSTEM

A database management system (or DBMS) is essentially nothing more than a computerized data-keeping system. Users
of the system are given facilities to perform several kinds of operations on such a system for either manipulation of the
data in the database or the management of the database structure itself. Database Management Systems (DBMSs) are
categorized according to their data structures or types.

A database management system (DBMS) is a software system that allows users to create, modify, and manage
databases. It provides an interface for users to interact with the database, and handles tasks such as data organization,
storage, retrieval, security, and backup and recovery.

A database is a collection of related data, organized in a structured manner that can be accessed and manipulated by
computer programs or users.

TOPIC: DATABASES AND DATABASE DESIGN (Fundamental Concepts of Database Management)

What is a database?

A database is a gathering of structured information, here called data, stored on a server/ dbms.

A database is a collection of organized data that is stored electronically. The data in a database is typically organized into
tables, which are made up of rows and columns. Here are some of the key components of a database:

1. Data: Data is the information that is stored in the database. It can include text, numbers, dates, images, and other
types of information.

2. Table: A table is a collection of related data that is organized into rows and columns. Each row represents a
single record, and each column represents a specific attribute or field of the record.

3. Column: A column is a vertical set of data in a table. Each column represents a single attribute or field of the
record, such as a person's name or age.

4. Rows A single group of related data within a table

5. Primary Key: A primary key is a unique identifier for each record in a table. It is used to ensure that each record
can be uniquely identified and accessed.
6. Foreign Key: A foreign key is a column in a table that refers to the primary key of another table. It is used to
create relationships between tables.

7. Index: An index is a data structure that is used to speed up data retrieval from a table. It allows data to be
accessed more quickly by creating a sorted list of values for a specific column or set of columns.

8. Views: A view is a virtual table that is based on the data from one or more tables in a database. It is used to
simplify data access and management by providing a customized view of the data.

These components work together to provide a structured and organized way of storing and accessing data in a database.

What are databases used for?

Improve business processes. Companies collect data about business processes, such sales, order processing and
customer service. They analyze that data to improve these processes, expand their business and grow revenue.

Keep track of customers. Databases often store information about people, such as customers or users. For example,
social media platforms use databases to store user information, such as names, email addresses and user behavior. The
data is used to recommend content to users and improve the user experience.

Secure personal health information. Healthcare providers use databases to securely store personal health data to
inform and improve patient care.

Store personal data. Databases can also be used to store personal information. For example, personal cloud storage is
available for individual users to store media, such as photos, in a managed cloud.

The Purpose of Database Applications

A database application can refer to two main concepts:

A software that work as a database management system, also known as a DBMS (eg., MongoDB, MSSQL, Oracle).

An application that heavily relies on database access, and its main purpose is to provide the data to the end-users or
other applications (eg., Facebook, Wikipedia, Amazon).

The main purpose of database applications is to provide a way for data to be consumed either by end users (via UI) or
other higher-level applications (via APIs). A database application can be used for storing or retrieving data, processing
transactions, or various machine learning calculations.

DATABASE APPLICATION TYPES

Database Application Type Pros Cons


 Flexible schema  Learning curve for SQL-
 Rich query language oriented developers
 Built-in resilience and  Relational schemas will need
scalability a redesign to work optimally
Database Software - Document  Rich indexing strategies
Store (eg., MongoDB)  Growing support communities
and open-source projects
 Transaction processing
 Distributed systems  Schemas are not flexible
 More modern data stores  Small support communities
 Not general purpose - good for
Database Software - Other NoSQL narrow use cases

 No transaction processing
 SQL-oriented  Expensive to start
Database Software - Relational  Large communities  Usually requires strong
Databases (SQL)  Owned by large companies hardware to start
 Not designed for the cloud era
 Offer robust services  Not flexible in the API
Database Application Providers -  Cloud-oriented  Limited ability to work with raw
(Amazon, Facebook) data
 Not a pure database software

Database applications can have a lot of features and abilities, but the main ones are to:

 Store and retrieve data efficiently.


 Provide a rich language API to interact with the data.
 Secure and allow a scalable access to the data as it grows.

What are some examples of database applications?

Database software (DBMS):

 MongoDB
 MySQL
 Oracle
 SQL Server

Database applications:

 Wikipedia
 Facebook
 CRM systems
 Account management systems
 Amazon

DIFFERENT APPROACH TO DATA MANAGEMENT

File System helps to store a collection of raw files of data into a hard disk, while DBMS is a software system, and it helps
to store, manipulate or recover data.

DATABASE MANAGEMENT SYSTEM FILE SYSTEM


(1) A file system is a program for handling and organizing the
files into a storage medium.
DBMS stores records, specified restrictions and FS stores data as isolated data as entities via File System
interrelationships.
Higher Security Less security

DATA MODEL

Data models are visual representations of an enterprise’s data elements and the connections between them. By helping to
define and structure data in the context of relevant business processes, models support the development of effective
information systems. They enable business and technical resources to collaboratively decide how data will be stored,
accessed, shared, updated and leveraged across an organization.

What is the purpose of a data model?

1. Provide a clear understanding of data requirements: Data models help identify what data is needed, how it should
be structured, and what relationships exist between data elements. This understanding ensures that data is
accurately captured and properly represented in information systems.
2. Facilitate communication and collaboration: Data models serve as a common language between technical and
non-technical stakeholders, ensuring that everyone involved in the data modeling process understands the data
requirements and can work together effectively.
3. Support database design and development: Data models serve as the blueprint for designing and building
databases. They provide a framework for organizing and storing data that is efficient, scalable, and easily
maintainable.
4. Enable efficient data processing: Data models help optimize data processing by identifying relationships between
data elements, defining data types and constraints, and establishing rules for data validation and integrity.

5. Improve data quality and consistency: By defining data structures and relationships, data models promote
consistency in data representation and reduce the risk of errors and inconsistencies in data processing.
6. Support data governance and compliance: Data models can help organizations comply with regulations and
policies related to data management and privacy by ensuring that data is properly classified, labeled, and
protected.

TYPES OF DATA MODELS

CONCEPTUAL DATA MODEL

is most relevant at the conceptual stage, when an organization drafts a rough plan with the intention to work out the finer
details later. Conceptual data models give stakeholders an easily digestible snapshot of the relevant concepts or entities
and the relationships between them. By communicating the model in a way that is relevant to stakeholders who aren’t
necessarily tech- and/or detail-oriented.
LOGICAL DATA MODEL

Referred to as information modeling. It helps organizations develop a visual understanding of the information they must
process to successfully complete specific tasks or business processes.

This stage is important because while the more streamlined conceptual data model is more easily communicated, the lack
of context can make it difficult to move from modeling to implementation. More detail is required to support that
progression. Such detail includes defining the owned attributes, primary keys, foreign keys, relationship cardinality and
describing entities and classes. At this stage, the nature of relationships between data is established and defined, and
data from different systems is normalized.

PHYSICAL DATA MODEL

These models are used to design the internal schema of a database. That includes all of the various tables, the columns
on those tables and the relationships between them. These models will be directly translated into production database
design, which will support further development of information systems.

CATEGORIES DATABASE LANGUAGE IN DBMS

Database Language is a special type of programming language used to define and manipulate a database.

1. Data Definition Language (DDL)

Data Definition Language (DDL) is a set of special commands that allows us to define and modify the structure
and the metadata of the database. These commands can be used to create, modify, and delete the database
structures such as schema, tables, indexes, etc.

2. Data Manipulation Language (DML)


Data Manipulation Language (DML) is a set of special commands that allows us to access and manipulate data
stored in existing schema objects. These commands are used to perform certain operations such as insertion,
deletion, updation, and retrieval of the data from the database.

3. Data Control Language (DCL)

Data Control Language (DCL) is a set of special commands that are used to control the user privileges in the
database system. The user privileges include ALL, CREATE, SELECT, INSERT, UPDATE, DELETE, EXECUTE,
etc.

We require data access permissions to execute any command or query in the database system. This user access
is controlled using the DCL statements. These statements are used to grant and revoke user access to data or
the database.

4. Transaction Control Language (TCL)

Transaction Control Language (TCL) is a set of special commands that deal with the transactions within the
database. A transaction is a collection of related tasks that are treated as a single execution unit by the DBMS
software. Hence, transactions are responsible for the execution of different tasks within a database.

It is used to undo the transactions that have not already been permanently saved (or committed) to the database.

The modifications performed using the DML commands are executed or rollbacked with the help of TCL
commands. These commands are used to keep a check on other commands and their effects on the database.

Highlights:

 Database Language is a special type of programming language used to define and manipulate a database.
 These are four different types: DDL, DML, DCL, and TCL.
 DDL commands are used to alter/create schema and metadata of the database.
 DML commands are used to access and manipulate data stored in existing schema objects.
 DML also contains the Data Query Language (DQL) commands that are used to retrieve data from the database.
 DCL commands are used to control the user privileges in the database system.
 TCL commands deal with the transactions within the database.
 In practice, a combination of DDL, DML, and DCL commands is implemented in the DBMS software.

EXAMPLES DATABASE LANGUAGE IN DBMS

1. SQL (STRUCTURED QUERY LANGUAGE)

It features both data definition and data manipulation languages and allows you to write queries in a database.
Specifically, SQL provides a way for you to extract and manage data in a relational database management
system. This type of DBMS organizes data into groups called relations.
2. XQuery (XML QUERY)

Is a database language that allows you to extract and manipulate data in XML formats, which is a way to share
data on the internet. You can use XQuery to access and retrieve any data source in an XML format. With XQuery,
you can generate reports on data within an XML database, search text documents on the web for data and extract
data for use online.

An example of a data endpoint for this query could be an e-commerce website that uses XQuery to retrieve
product data from an XML file or database. The query could be used to retrieve the names of all products that
meet a certain price threshold, which could then be displayed on the website for users to browse or search.

3. OQL (Object Query Language)

OQL (Object Query Language) is a database query language designed to work with object-oriented databases.
Here's an example query using OQL:

SELECT p.name, p.price FROM Product p WHERE p.category = 'Electronics' AND p.price > 1000

OQL is used primarily in object-oriented databases where data is represented as objects and their relationships. It
allows users to easily retrieve data and manipulate objects using a query language that is similar to SQL, but with
additional support for object-oriented concepts such as inheritance and polymorphism. OQL can be used in a
variety of applications, including e-commerce websites, financial systems, and other applications that rely on
complex data structures.

4. GraphQL

GraphQL is a query language for APIs that was developed by Facebook in 2012. It provides a more efficient,
powerful, and flexible way to communicate with APIs and retrieve data.
DATABASE DESIGN

Database design is the process of creating a plan for how data is organized in a database management system (DBMS).
It involves identifying the data that needs to be stored, determining how that data will be structured and related to other
data, and defining the rules and constraints that will govern how the data can be accessed and modified.

DATABASE LIFECYCLE

Refers to the series of stages involved in the development, maintenance, and management of a database.

here are generally six stages of the database lifecycle:

1. Analysis

The analysis phase is where the stakeholders are interviewed and any existing system is examined to
identify problems, possibilities and constraints. The objectives and scope of the new system are determined.

The following are the steps in the Analysis Phase.

 Analyze the organization


 Define any problems, possibilities or constraints
 Define the objectives
 Agree on the scope

Common methods used:

 Interviews
 Surveys and questionnaires
 Observation
 Prototyping
 Data modeling

2. Conceptual Design

The purpose of the conceptual design phase is to build a conceptual model based upon the previously identified
requirements, but closer to the final physical model. A commonly-used conceptual model is called an entity-
relationship model.
Entities and attributes

In conceptual design, entities and attributes are the building blocks used to create a conceptual model of the data.
The process of identifying entities and attributes involves analyzing the requirements of the system and identifying
the key objects or concepts that need to be represented in the database.

Entities are basically people, places, or things you want to keep information about.

Attributes refer to the characteristics or properties that describe the data entities.

The following are examples of entities involving a university with possible attributes in parentheses.

 Course (name, code, course prerequisites)


 Student (first_name, surname, address, age)
 Book (title, ISBN, price, quantity in stock)

This allows designers to focus on the requirements and the relationships between the entities and attributes,
rather than getting bogged down in technical details. The resulting conceptual model serves as a blueprint for the
rest of the design process, enabling designers to move on to logical and physical design.

Relationships

Are used to describe the associations or connections between the entities in a database. Relationships are an
important aspect of database design, as they help to define the structure and organization of the data.

a. One-To-One Relationship

A type of relationship where one instance of an entity is associated with only one instance of another entity.
This means that for every entity in one table, there is a corresponding and unique entity in another table.

A one-to-one (1:1) relationship means that each record in Table A relates to one, and only one, record in
Table B, and each record in Table B relates to one, and only one, record in Table A. Look at the following
example of tables from a company's Employees database:

In a one-to-one relationship, either table can be considered to be the primary or parent table.

b. One-To-Many Relationship

A type of relationship in which a single instance of one entity can be related to multiple instances of another
entity. In other words, a single record in one table can be related to multiple records in another table.

A one-to-many (1:N) relationship means a record in Table A can relate to zero, one, or many records in Table
B. Many records in Table B can relate to one record in Table A. The potential relationship is what's important;
for a single record in Table A, there might be no related records in Table B, or there might be only one related
record, but there could be many. Look at the following tables about a company's Customers and Orders.
In a one-to-many relationship, the table on the one side of the relationship is the primary table and the table
on the many side is the related table.

c. Many-To-Many Relationship

A many-to-many relationship is a type of relationship in which one or more instances of one entity can be
associated with multiple instances of another entity, and vice versa. This means that a record in one table can
be related to multiple records in another table, and vice versa.

ENTITY RELATIONSHIP: DEFINING AND CREATING ER DIAGRAMS

You might also like