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

01 Database System

Uploaded by

Hein Htet Zaw
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

01 Database System

Uploaded by

Hein Htet Zaw
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 35

Database System

DIT201 Database System


Asst. Prof. Dr. Parkpoom Chaisiriprasert
What is an
Information System ?
Information System
Basic Concept of Information System
Server Client

Network
Communication

Application Client

Client
Data
What is data in
Information System ?
Digital data in Information Technology

The fundamentals of digital data are


binary and text files; text files store
data in human-readable format, and
binary files are stored in binary form,
i.e., 0s and 1s.
Problems of file processing system

Data Data Data Integrity Concurrent Atomicity Limited


Redundancy Inconsistency problem Access Problem problem Data
Security
Data Redundancy

Data redundancy means the occurrence


of duplicate copies of similar data. It is
done intentionally to keep the same
piece of data at different places, or it
occurs accidentally.
Data Inconsistency

If multiple copies of the same data do not


match each other. Data inconsistency
refers to a situation where the same piece
of information is represented differently or
contradicts itself across different parts of
the data.
Data Integrity

Data integrity refers to the accuracy,


consistency, and reliability of data
throughout its information lifecycle. It
ensures that data remains unaltered,
complete, and trustworthy, regardless
of whether it's stored in databases,
files, or any other storage medium.
Concurrent Access

When a number of users operates on a


common data in database at the same
time then anomalies arise, due to lack
of concurrency control. Concurrency
refers to the sharing of resources by
multiple interactive users or application
programs at the same time.
Atomicity

It ensures that a transaction is treated as


a single, indivisible unit of work, and
either all of its operations are completed
successfully or none of them are.
Atomicity guarantees that a transaction
is either fully executed or fully rolled back
in case of failure, ensuring that the
database remains in a consistent state.
Limited Data Security

Data systems often lack robust


security features to control access
to data. It's difficult to implement
access controls and permissions at
a granular level, which can lead to
unauthorized access and data
breaches.
Types of Data

Structured Unstructured Semi-structured


Data Data Data

https://www.bigdataframework.org/data-types-structured-vs-unstructured-data/
Structured data

Structured data can be represented in


rows and columns, just like a table. It
has a well-defined schema, and a rigid
structure. These characteristics make
relational databases, which store data in
tables, ideal for structured data.
Unstructured data

Unstructured data doesn’t have an


identifiable structure; it doesn’t
follow any specific format,
sequence, semantics, or rules.
Common examples of unstructured
data include audio, video files or
No-SQL databases.
Semi-structured

Semi-structured data has some organizational properties,


but not enough to be easily stored in the rows and
columns required by a rigid, tabular schema.
Therefore, it is also known as a
self-describing structure. Examples
of semi-structured data include
JSON and XML are forms of semi-
structured data.
Relational vs. Non-relational Databases
Relational Databases Non-relational Databases
Relational Databases
● Work with structured data.
● Relationships in the system have constraints, which promotes a high
level of data integrity.
● The ability to write complex SQL queries for data analysis and
reporting.
● Ensure and enforce business rules at the data layer adding a level of
data integrity
● Use structured query language for shaping and manipulating data.
Non-relational Databases
● The ability to store large amounts of data with little structure.
● Scalability and flexibility to meet changing business requirements.
● The ability to capture all types of data “Big Data” including
unstructured data.
● NoSQL or non-relational databases examples: MongoDB, Apache
Cassandra, Redis, Couchbase and Apache HBase.
● Rapid Application Development.
● NoSQL is the best selection for flexible data storage with little to no
structure limitations.
Relational Database

A database is a collection of data


with a structure that allows users
to search for and access related
information. It primarily consists of
tables that organize and display
data in a way that makes it easy
to use. Its structure describes the
relationships between tables.
Structure of a database table

Attribute

Entity

Schema - - - -
Record

Value
Data Value Types

Data types are used to Students

represent the nature of ID Name Surname Mobile BIrthday

the data that can be 5703597 อภิชา ดีอา


รมย์
08xxxxxxxx 6/18/2004

stored in the database 5706613 ณฐพล ชั้น


ประดับ
06xxxxxxxx 10/3/2006

table.
● String Data types
● Numeric Data types
● Date and time Data
String Data Types

CHAR(Size) It is used to specify a fixed length string that can contain


numbers, letters, and special characters. Its size can be 0 to
255 characters. Default is 1.

VARCHAR(Size) It is used to specify a variable length string that can contain


numbers, letters, and special characters. Its size can be from 0 to
65535 characters.

TEXT(Size) It holds a string that can contain a maximum length of 255


characters.
Numeric Data types
INT(size) INT(size) It is used for the integer value. Its signed range varies
from -2147483648 to 2147483647 and unsigned range varies from
0 to 4294967295.

DECIMAL(size, Its size parameter specifies the total number of digits. The number
d) of digits after the decimal parameter is specified by d parameter.
The maximum value for the size is 65, and the default value is 10.
The maximum value for d is 30, and the default value is 0.
DATE/TIME Data Types

DATE It is used to specify date format YYYY-MM-DD.

TIME It is used to specify the time format. Its format is hh:mm:ss.

DATETIME It is used to specify date and time combination. Its format is YYYY-
MM-DD hh:mm:ss.

TIMESTAMP It is used to specify the timestamp. Its format is YYYY-MM-DD


hh:mm:ss. Automatic initialization and updating to the current date
and time can be specified using DEFAULT CURRENT_TIMESTAMP and
ON UPDATE CURRENT_TIMESTAMP in the column definition
Why relationships are important
Reduced data redundancy: relationships help reference information
stored in existing tables, reducing repetition.
Increase data consistency: relationships help implement database
normalization techniques. Normalization helps yield data consistency
and a more robust database.
Referential integrity: As databases grow, joins, queries, and sorting
become more expensive. Relationships help reduce the number of
transactions and improve the validity of data.
Database table relationships
Identifying the connections between tables is part of
the data modeling and schema design process. This
process often involves creating a visual
representation of tables and their relationships,
known as an entity relationship diagram (ER-
Diagram).
● One-to-One
● One-to-Many or Many-to-One
● Many-to-Many
One-to-One
A one-to-one relationship
(1:1) in a database has one
record on each side of the
relationship. Every primary
key relates to at most one
entry from another table,
making the foreign key
unique.
One-to-Many
A one-to-many (1:N)
relationship in a database
has a single entry on one
side and multiple entries on
the other end. Every
primary key corresponds to
one or more records from
another table. In this case,
the foreign key is not
Many-to-Many
Many-to-many (N:N)
relationships in a database
have multiple entries on both
ends of the relationship. Since
numerous entries may exist
on both ends, a standard
solution is to create an
association (junction, join)
table with foreign keys from
To reducing repetition
Students

Primary Key ID Name Surname Mobile Birthday

5703597 อภิชา ดีอา 08xxxxxxxx 6/18/2004


รมย์

5706613 ณฐพล ชั้น 06xxxxxxxx 10/3/2006


ประดับ

A primary key (PF) guarantees unique data in columns and enforces the
integrity of the table in the database.
Data redundancy

Students

ID Name Surname Mobile Birthday College CollegeName Building

5703597 อภิชา ดีอา 08xxxxxxxx 6/18/2004 014 Digital Innovation Technology 11


รมย์

5706613 ณฐพล ชั้น 06xxxxxxxx 10/3/2006 014 Digital Innovation Technology 11


ประดับ

… … … … … 014 Digital Innovation Technology 11

… … … … … 014 Digital Innovation Technology 11

… … … … … 014 Digital Innovation Technology 11


To enforce integrity by using the relationships
between tables.
Students

ID Name Surname Mobile Birthday CID


Colleges
5703597 อภิชา ดีอา 08xxxxxxxx 6/18/2004 014
รมย์ CID CallegeName Building

5706613 ณฐพล ชั้น 06xxxxxxxx 10/3/2006 014 011 Engineering 5


ประดั

014 Digital Innovation Technology 11

A foreign key (FK) is a column that corresponds to the primary


key in another table and also creates a relationship between
two tables.
End.
DIT201

You might also like