INFOSYS 222
DATABASE SYSTEMS
KEY CONCEPTS AND INTRODUCTION TO
RELATIONAL DATABASES
Udayangi Muthupoltotage
Data is everywhere.
It is being generated,
consumed, processed
and used to generate
insights continuously
[Link]
2
Key Concepts
• What is data?
Data
• Data Vs. Information
Database
Management • What is a database ?
System • What is DBMS?
(DBMS)
3
Data
Raw, unprocessed facts and figures
4
Data to information
• Data vs. information
– Data are the ‘building blocks’ of information
– Information is data that is processed, organized, structured
or presented in a given context so as to make it useful
– Information is data with a specific meaning associated with
it.
– High quality information is key to decision making
Processing
Data Information
here
5
Essential features of Information
▪ Timely - Delivered to the right person at the right time in
order to make the right decision.
▪ Accurate – Correct / reliable / valid
▪ Complete – Have all the available information in order to
make the right decision
6
Identify what processing could convert this data in to
meaningful information
Context : Clare’s scores in the 4 INFOSYS 222 assessments in order
Raw Data 96, 74, 59, 89
Processing ?
Information ?
7
Identify what processing could convert this data in to
meaningful information.
Provide some examples of KNOWLEDGE which could be
gleaned from the information you suggested.
Context : Responses to market research question – “Would you
buy brand X organic coffee at $16.00 for 200g?”
No, Yes, No, Yes, No, Yes, No,
Raw Data Yes, No, Yes, Yes, No, No
Processing
?
Information ?
8
Raw Data
Processing
Information
Knowledge
9
Database
Database
Management
System (DBMS)
What is a database?
– A database is a structured collection of data /
information.
– A database management system (DBMS) is special
software designed to help manage the database
– A database system can be thought of as the database +
a DBMS
11
What is a database?
Employee
Database
Demonstration
Database characteristics
– Database (digital/software) is typically a shared, integrated
computer structure housing:
• End-user data
– E.g.
• Metadata
13
Metadata example
14
DBMS Features
– Examples: SQL Server, Oracle, Teradata, MySQL, Access, Sqlite
etc.
– Data storage management
• Structure (tables, columns, etc.)
• Data integrity management
– Security management
– Multi-user access control
– Backup and recovery management
– Database language and application programming interfaces
• Query language (SQL)
– Database communication interfaces
15
Importance of DBMS
– Makes data management more efficient and effective
– Query language allows support for data-retrieval,
data-manipulation, structured reporting, and quick answers
to ad hoc (non-structured/one-off) queries
– Provides better access to more and better-managed data
– Reduces the probability of inconsistent data
– Promotes integrated view of organisation’s operations
16
What happens when database management
is not used?
– Files used to
manage
financial data
– No database
systems in
place
17 Source: [Link]
INTRODUCTION TO RELATIONAL DATA
MODEL
Key concepts
• What is a relational
Relational database?
Data • Components of the relational
data model
Model • What does each term mean?
19
Relational Database
• All major general purpose DBMSs are based on the
relational data model. This means that all data is
stored in a number of tables (with named columns)
• For historical, mathematical reasons such tables are
referred to as relations.
• The tables show data together with relationships
between the data.
• Enables user to view data logically as a
two-dimensional structure composed of rows and
columns
• This course is solely on relational database, and on
20 relational DBMS
RDBMS Looks like… A collection of Tables
Publisher
Author
Connections
between the tables –
Book
RELATIONSHIPS
Multiple Tables
RELATIONS
Image Source : [Link]
21
The relational data model
• A relational data model is a precise, conceptual way of
describing the data stored in a relational database
- Structure of the data
- Operations on the data
- Constraints on the data
22
A Relation (Table)
• A Relation – stores data on individual things, which
are considered important.
- People (Employee, Student, Staff Member)
- Objects – (Book, Product, Lecture Room)
- Concepts / Actions – (Transaction in an ATM, Borrowing a
book from the library)
23
Structure of the data - Relation (Table)
• A relation consists of rows and columns
• The column headers will describe the data.
• The number of columns are fixed – definite number
• The number of rows – indefinite
• Each intersection between a row and column (cell)
contains a single item of data.
• Each Row will describe a single instance of the data.
24
Example Relation - BOOK
A record Each cell should hold a
single data item.
ISBN Title Author PublicationYear
0-123-1233-0 The Three Alexandre 1953
Musketeers Dumas
0-124-2999-9 A Dog's Tale Mark Twain 1904
•Each row should describe a single book using the column
headers
•This makes each row a record providing information about
25
a single book
Example Relation - STUDENT
What could be the possible column headers for a
relation called STUDENT, for storing a student’s identity
information?
26
Tuple (Row)
• A relation consists of tuples (Rows)
• A tuple is an ordered list of values
• Tuples are usually written in parentheses, with commas
separating the values (or components)
•
• e.g. Employee Relation
(7369, SMITH, M, Technician )
• Order is significant,
e.g., the tuple (7369, Technician, SMITH, M,)
is different from the tuple above
27
Attribute (Column/ Field )
• In order to be able to refer to the different components
in a tuple, we will assign them names (called
attributes)
• Example:
• For the tuple (7369, SMITH, Male, Technician )
• We might choose the attributes
• ID, Name, Gender, JobDescription
28
Data type
• The value of an attribute belongs to a domain; also
known as a data type of an attribute
• All attributes must have a data type, but the data types
available depend on the particular DBMS.
• However, the following are commonly available among
different implementations:
• TEXT for text strings
• INTEGER for integers
• REAL for real numbers
• DATE for dates
29
Schema
• In the relational data model, a relation is often
described using a schema which consists of:
- the name of the relation
- the set of its attributes (sometimes with data types)
• Example: The relation Employee can be described by
the schema:
• Employee (ID, Name, Gender, JobDescription)
• Employee(ID INTEGER, Name TEXT, Gender TEXT,
JobDescription TEXT)
• The schemas of all relations in a database form a
database schema
30
Relation instance
• A relation is not static; it changes over time:
- Inserting new tuples
- Updating components of existing tuples
- Deleting tuples
• A set of tuples for a relation at a moment is an instance
of that relation.
• A DBMS maintains - the current instance
31
Key
• An attribute or a set of attributes used to uniquely
identify a tuple.
- Two employees will not have the same ID
• This unique attribute/ attributes is called the Primary
Key
• You can introduce an artificial key, if no suitable
attribute/ attributes exist
32
Exercise
An organization has 6 Employees for whom identity
information including gender is stored in a database.
The organization has four separate Departments within
the organization.
Identify the relations which can be used for this
purpose.
Make as many assumptions as needed regarding the
data to be stored in each relation.
33