0% found this document useful (0 votes)
17 views23 pages

Lecture 8 Introduction To Databases (Updated)

The document outlines the content and learning objectives for a seminar on databases as part of the Transforming Business with Information Systems course. It emphasizes the importance of databases in managing increasing business data and highlights the characteristics and functionalities of relational databases. Additionally, it discusses the transition from flat file systems to relational databases for better data organization and business intelligence.

Uploaded by

Mike Chui
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)
17 views23 pages

Lecture 8 Introduction To Databases (Updated)

The document outlines the content and learning objectives for a seminar on databases as part of the Transforming Business with Information Systems course. It emphasizes the importance of databases in managing increasing business data and highlights the characteristics and functionalities of relational databases. Additionally, it discusses the transition from flat file systems to relational databases for better data organization and business intelligence.

Uploaded by

Mike Chui
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/ 23

14/4/2025

Transforming Business with Information Systems


BISM1201

Seminar 8 – Introduction to databases


Week 8 Lecturer: Keith Harbottle

Lecturer and course coordinator: Shahrzad Roohy Gohar

Overview of exam content (past and ahead weeks)

A head Theory Topics A ssessm ent E xcel Topics A ssessm ent

W eek 5 IS D W aterfall Final exam only V LO O K U P, etc A ssignm ent 2

W eeks 6 & 7 IS D A gile and S crum Final exam only V LO O K U P, C O N C AT, IF, A ssignm ent 2
LE FT, R IG H T etc.
W eek 8 D atabases (tables, D B M S ) Final exam only V LO O K U P, X LO O K U P, A ssignm ent 2 and
U N IQ U E , S O RT, Final exam
FILTE R .
W eek 9 D atabase E R D s, m ore database rules Final exam only U N IQ U E , S O RT, A ssignm ent 2 and
FILTE R , R E P LA C E Final exam
W eek 10 D atabases dem onstration Final exam only G oal S eek Final exam only

W eek 11 B usiness intelligence (data w arehouses, Final exam only S olver Final exam only
types of B I)
W eek 12 B usiness intelligence (M L, A I) Final exam only S olver Final exam only

G uest Lecturer: D r Yao Zhao (B usiness


A nalytics and Intelligence)
W eek 13 N o new content. E xam preparation

Learning objectives
• W hat is a database, and how does a relational database organise data?

• W hat are the characteristics of a relational database and how to structure one?
• W hat are the principles of a database management system?
• W hat are the principal tools and technologies for accessing information from databases to improve
business performance and decision making?

Reading: sections 6.1 and 6.2 of the textbook.

1
14/4/2025

Databases

Why we need databases?


• The amount of business data that needs to be stored and processed has consistently
increased each year.
• Includes multiple types of data – sales, purchases, salary activities, client inquiries, and much
more. Data is increasing exponentially with the popularity of digital, online business, and
digital traces (e.g. from social media)
• The database has been spectacularly successful and is now considered very mature
technology.
• Businesses have realized that, within this huge volume of database -stored transaction data –
there is an additional, highly valuable commodity. This commodity is called “business
intelligence” and it is becoming critically important to business.

Databases

Why we need databases?

Cust ID Cust name Agent ID Agent name Order ID Order date Toy ID Toy name Toy unit price Quantity Total price
1 Sherry Don CB Cat Bon 001 6/04/22 DA Drone A $ 500.00 1 $1,250
1 Sherry Don CB Cat Bon 001 6/04/22 LA Lego Architect $ 750.00 1 $1,250
2 Jack Bickleben KR Kevin Row 002 7/04/22 BMWM BMW Motorbike $ 500.00 1 $500
3 Jules Bicep SC Sam Curl 003 7/04/22 RH Rocking Horse $ 1,000.00 2 $2,000
4 Liam Hamsbor DK Daisy Kot 004 08/04/22 TB Teddy Bear $ 750.00 1 $2,750
4 Liam Hamsbor DK Daisy Kot 004 08/04/22 DB Drone Bmax $ 1,000.00 2 $2,750
5 Maria Barry DB David Bham 005 08/04/22 DH Doll House $ 2,000.00 1 $2,000.00

How many purchases have been made April 7-8 th ?

Total successful sales for each agent?


Total sales for each toy?

Total sales to each customer in April?

Databases

Why we need databases?


How many transactions have been made April 2023?

Total successful sales for each agent?


Total sales for each toy?
Total sales to each customer?

Why repeating the records?


Cust ID Cust name Agent ID Agent name Order ID Order date Toy ID Toy name Toy unit price Quantity Total price
1 Sherry Don CB Cat Bon 001 6/04/22 DA Drone A $ 500.00 1 $1,250
1 Sherry Don CB Cat Bon 001 6/04/22 LA Lego Architect $ 750.00 1 $1,250
2 Jack Bickleben KR Kevin Row 002 7/04/22 BMWM BMW Motorbike $ 500.00 1 $500
3 Jules Bicep SC Sam Curl 003 7/04/22 RH Rocking Horse $ 1,000.00 2 $2,000
4 Liam Hamsbor DK Daisy Kot 004 08/04/22 TB Teddy Bear $ 750.00 1 $2,750
4 Liam Hamsbor DK Daisy Kot 004 08/04/22 DB Drone Bmax $ 1,000.00 2 $2,750
5 Maria Barry DB David Bham 005 08/04/22 DH Doll House $ 2,000.00 1 $2,000.00
1 Sherry Don CB Cat Bon 001 6/04/23 DA Drone A $ 500.00 1 $1,250
1 Sherry Don CB Cat Bon 001 6/04/23 LA Lego Architect $ 750.00 1 $1,250
2 Jack Bickleben KR Kevin Row 002 7/4/23 BMWM BMW Motorbike $ 500.00 1 $500
3 Jules Bicep SC Sam Curl 003 7/4/23 RH Rocking Horse $ 1,000.00 2 $2,000
4 Liam Hamsbor DK Daisy Kot 004 8/4/23 TB Teddy Bear $ 750.00 1 $2,750
4 Liam Hamsbor DK Daisy Kot 004 8/4/24 DB Drone Bmax $ 1,000.00 2 $2,750
5 Maria Barry DB David Bham 005 08/04/23 DH Doll House $ 2,000.00 1 $2,000.00
1 Sherry Don CB Cat Bon 001 6/04/23 DA Drone A $ 500.00 1 6
$1,250
1 Sherry Don CB Cat Bon 001 6/04/23 LA Lego Architect $ 750.00 1 $1,250
2 Jack Bickleben KR Kevin Row 002 7/04/23 BMWM BMW Motorbike $ 500.00 1 $500
3 Jules Bicep SC Sam Curl 003 7/04/23 RH Rocking Horse $ 1,000.00 2 $2,000

6
4 Liam Hamsbor DK Daisy Kot 004 7/04/23 TB Teddy Bear $ 750.00 1 $2,750
4 Liam Hamsbor DK Daisy Kot 004 7/04/23 DB Drone Bmax $ 1,000.00 2 $2,750
5 Maria Barry DB David Bham 005 6/04/23 DH Doll House $ 2,000.00 1 $2,000.00
1 Sherry Don CB Cat Bon 001 6/04/23 DA Drone A $ 500.00 1 $1,250
1 Sherry Don CB Cat Bon 001 8/4/24 LA Lego Architect $ 750.00 1 $1,250
2 Jack Bickleben KR Kevin Row 002 8/4/24 BMWM BMW Motorbike $ 500.00 1 $500
3 Jules Bicep SC Sam Curl 003 8/4/24 RH Rocking Horse $ 1,000.00 2 $2,000
4 Liam Hamsbor DK Daisy Kot 004 7/04/23 TB Teddy Bear $ 750.00 1 $2,750
4 Liam Hamsbor DK Daisy Kot 004 7/04/23 DB Drone Bmax $ 1,000.00 2 $2,750
5 Maria Barry DB David Bham 005 7/04/23 DH Doll House $ 2,000.00 1 $2,000.00

2
14/4/2025

Databases

Why not just use a flat file?


• For example, a store could record sales data in a table, one
row per sale.
• There’s a lot of redundancy here.
• We’re told three times that Alvin made a purchase on
January 17 and lives in Santa Rosa.
• We are also told twice that hammers cost $15, that a pair of
pliers costs $10, and that paint brushes sell for $5. More
records would show more redundancy.
• Flat files may suffice for small files. If you want to track your
car’s maintenance, recording what was done, when, where,
and how much it cost, a fat file will do—and you can put it on
a spreadsheet.
• If you need to track feet maintenance for thousands of
trucks, including information about the technicians who did
the work, the time it took, and return visits to correct
problems, you need more.
• Flat files are rare in business and are never used for
important systems. Databases are near universal. With a
database, normalization is important.

(Mallach 2016)
7

Databases

What is a database?
• A collection of data organised to service many applications at the same time by
storing and managing data so that they appear to be in one location

• A group of related fields

• A collection of related information. The information held in the database is stored in


an organised way so that specific items can be selected and retrieved quickly

• Data represented as one or more two-dimensional tables with columns and rows

Databases

Why do we need to know about databases?


• A business analyst needs to fully appreciate that a business relational database can only
operate efficiently if its logical design is complete and correct.
• All IS, whether it is an ERP system, or Facebook rely on a core repository to keep the data.
• Decisions on business rules for a database are not made by technicians but by analysts e.g.,
“should an owner of a video on a video streaming service be able to rate/review their own
video”?
• The database is critical to the storage of transaction data that is vital to business operation.
• The database now can be used to provide this huge volume of accumulated transaction data
for further analysis – which in turn produces this new, highly valued commodity of business
intelligence.

3
14/4/2025

10

Databases

What do databases do beyond storage?


• Relational databases enable data to be stored within multiple different tables
• Search, add, amend, delete records
• Multi-user access, distributed access, speed, data quality, security, space
efficiency

11

11

Databases

Example of what a database can do


Facebook is giant database at heart, with a front-end program that takes data from that database and
arranges it on a webpage. Think about the information it has:
• Your profile information, such as your name, DoB, username, password, gender, where you live(d)
etc.
• Events in your timeline
• Photos which can be linked to events or people
• Friend connections, A is a friend of member B, and so on
• W hat users are following, e.g. persons, groups, etc
• Likes, which one member likes a comment, photo, or other content.
• This are stored in many database tables.

Imagine the power of a query like: show me persons aged under 25, that live in Australia, that like
running à to provide running shoe advertising to.
(Mallach 2016)

12

12

4
14/4/2025

Databases

Example of what a database can do


• Facebook is giant database at heart, with a front-end program that takes data from that database and
arranges it on a webpage.

Shaz

13

13

Databases

“Old” and “new” business data architecture


‘O ld’ B usiness D ata A rchitecture ‘N ew ’ B usiness D ata A rchitecture

This architecture provides:


This architecture has many disadvantages:
• Consistency and accuracy of single data storage
• Redundancy and inaccuracy • Integration of systems – facilitates a single management
• Non-integration and a lack of a ‘business wide’ view view of the business
• Now considered one of the most successful business
software solutions of the past 30 years or more.
14

14

Databases

Relational databases
Work with large amounts of data efficiently, make updating data easy and reliable and ensure
accuracy, data security and avoiding redundancy

• The concept of the relational model is very simple:


• A relational database organizes and stores data in databases that are related, and presents data in one
or more two-dimensional tables.
• It organizes data into two-dimensional tables (relations) with columns and rows, each table is shown to a
user, human or software, as rows and columns
• For a relational database to work efficiently, there will always be multiple tables.
• The idea of one huge table within a relational database is simply not workable.
• Tables of related data are relations

15

15

5
14/4/2025

Databases

Relational databases
Work with large amounts of data efficiently, make updating data easy and reliable and ensure
accuracy, data security and avoiding redundancy
• One Table for each Entity:
E.g., CUSTOMER, SALES, AGENT, STOCK, SUPPLIER, etc
Fields (Columns) store data representing an Attributes of an Entity
Rows store data for separate records of instances of an entity

Example: CUSTOMER Table : sharing same attributes

16

16

Databases

Relational databases
Entity: is anything of interest to the users of the database. An entity is a person, place, thing or event to be
recorded in the database. Entities will almost always occur as the nouns, or naming words, in the user’s
description of their work e.g. in a university environment, a user may speak of students, courses, lecturers,
and degrees. They are not an instance (e.g. an individual person).
Attribute: a specific characteristic or quality of a particular entity e.g. for a table on “Students”,
characteristics would include student_name and student_address to distinguish one instance of a student
from another we give them a different name, address, and so on.
Record: a group of related fields (e.g. a row) for an instance of entity
Field: A field describe some detail or characteristic of a record (e.g. a single cell).

17

17

Databases

Relational databases
Example: Customer Table
• Entity: Customer
• Attributes: Customer name, Customer Address, Customer Phone number, Loyalty Level
• Records or Instances example; Sherry Don, from address xxxxxxxaaaa, with phone number (00)12234323 is
in Red tier of loyalty program

Cust name Cust Address Cust Phone # Loyalty level


Sherry Don xxxxxxxaaaa (00)12234323 Red
Jack Bickleben xxxxxxxbbbb (00)23336543 Blue
Jules Bicep xxxxxxcccc (00)35534323 Silver
Liam Hamsbor xxxxxxxdddd (00)12234352 Gold
Maria Barry xxxxxxxdddd (00)12263098 Gold
Sherry Don yyyyyyydddd (01)12745695 Blue

W hat happens when two people have the same name?

18

18

6
14/4/2025

Databases

Relational databases
Example: Customer Table
• Entity: Customer
• Attributes: Customer name, Customer Address, Customer Phone number, Loyalty Level
• Records of Instances example; Customer #1, Sherry Don, from address xxxxxxxaaaa, with phone number
(00)12234323 is in Red tier of loyalty program

Unique value
Cust ID Cust name Cust Address Cust Phone # Loyalty level
1 Sherry Don xxxxxxxaaaa (00)12234323 Red
2 Jack Bickleben xxxxxxxbbbb (00)23336543 Blue
3 Jules Bicep xxxxxxcccc (00)35534323 Silver
4 Liam Hamsbor xxxxxxxdddd (00)12234352 Gold
5 Maria Barry xxxxxxxdddd (00)12263098 Gold
6 Sherry Don yyyyyyydddd (01)12745695 Blue
• Unique value can also be used as KEYS
• KEYS refer to only one specific row or record
19

19

Databases

Relational databases
Examples: Toy_Price Table, Order_Price Table
• Entity: Customer
• Attributes: Customer name, Customer Address, Customer Phone number, Loyalty Level
• Records of Instances example; Customer #1, Sherry Don, from address xxxxxxxaaaa, with phone number
(00)12234323 is in Red tier of loyalty program

Unique value
Unique value
Toy ID Toy name Toy unit price Order ID Order date Total price
DA Drone A $ 500.00 001 6/04/22 $1,250
LA Lego Architect $ 750.00 002 7/04/22 $500
BMWM BMW Motorbike $ 500.00 003 7/04/22 $2,000
RH Rocking Horse $ 1,000.00 004 08/04/22 $2,750
TB Teddy Bear $ 750.00 005 08/04/22 $2,000.00
DB Drone Bmax $ 1,000.00
DH Doll House $ 2,000.00

• Unique value can also be used as KEYS


• KEYS refer to only one specific row or record
20

20

Databases

Relational databases: Primary Key


A unique value, or unique combination of two or more attributes will form the Primary Key of our
entity, and later the table in the database.
Primary key can be defined by:
Integer number, decimal number, date, text, etc.
Constrained to be certain type, length, or to have a value between two limits
Unique value:
Primary Key
Cust ID Cust name Cust Address Cust Phone # Loyalty level
1 Sherry Don xxxxxxxaaaa (00)12234323 Red
2 Jack Bickleben xxxxxxxbbbb (00)23336543 Blue
3 Jules Bicep xxxxxxcccc (00)35534323 Silver
4 Liam Hamsbor xxxxxxxdddd (00)12234352 Gold
5 Maria Barry xxxxxxxdddd (00)12263098 Gold
6 Sherry Don yyyyyyydddd (01)12745695 Blue

Benefit? Accessing specific records easily

21

21

7
14/4/2025

Databases

Relational databases: Primary Key


• Attribute(s) (e.g. Student_number) that uniquely identifies each record in a table.
• Can be one or more attributes that together identifies a unique row in a table.
• Must be unique, there can be no duplication of attributes in the column(s) chosen as the primary key
• Often the primary key is the name of the table or an identifier e.g. ID, reference, code etc.
• There is ONLY one primary key per table; when several fields are used – this is called a compound primary
key.
• Each table must have a primary key – never create a table without specifying the primary key.
• W ithout a Primary Key the database will not be able to perform Update or Delete functions on the table.

NOTE: Uniqueness does not mean Primary Key

22

22

Databases

Relational databases: Composite key


A unique value, or unique combination of two or more attributes will form the Primary Key.

Primary key can be defined by:


Integer number, decimal number, date, text, etc.
Constrained to be certain type, length, or to have a value between two limits

NOTE: If more than one of


the same product is required
on an order, then only the
Quantity needs to be
updated

24

24

Databases

Relational databases: the need to create relationships


How to connect the data from different entities? How to associate them with each other?

Cust ID Cust name Cust Address Cust Phone # Loyalty level Toy ID Toy name Toy unit price
1 Sherry Don xxxxxxxaaaa (00)12234323 Red DA Drone A $ 500.00
2 Jack Bickleben xxxxxxxbbbb (00)23336543 Blue LA Lego Architect $ 750.00
BMWM BMW Motorbike $ 500.00
3 Jules Bicep xxxxxxcccc (00)35534323 Silver
RH Rocking Horse $ 1,000.00
4 Liam Hamsbor xxxxxxxdddd (00)12234352 Gold TB Teddy Bear $ 750.00
5 Maria Barry xxxxxxxdddd (00)12263098 Gold DB Drone Bmax $ 1,000.00
6 Sherry Don yyyyyyydddd (01)12745695 Blue DH Doll House $ 2,000.00

Agent ID Agent name Average Daily Sales in April Order ID Order date Total price
CB Cat Bon $5,000.00 001 6/04/22 $1,250
KR Kevin Row $2,500.00 002 7/04/22 $500
SC Sam Curl $7,000.00 003 7/04/22 $2,000
004 08/04/22 $2,750
DK Daisy Kot $3,000.00
005 08/04/22 $2,000.00
DB David Bham $4,000.00

Query examples:
Select toys that have been customers’ favourite toy in 2022
Find agents with highest order values for top tier customers
25

25

8
14/4/2025

Databases

Relational databases: how to connect tables?

Toy ID Toy name Toy unit price Cust ID Cust name Cust Address Cust Phone # Loyalty level Favourite Toys
DA Drone A $ 500.00 1 Sherry Don xxxxxxxaaaa (00)12234323 Red DA
LA Lego Architect $ 750.00 2 Jack Bickleben xxxxxxxbbbb (00)23336543 Blue DA
BMWM BMW Motorbike $ 500.00 3 Jules Bicep xxxxxxcccc (00)35534323 Silver BMWM
RH Rocking Horse $ 1,000.00
4 Liam Hamsbor xxxxxxxdddd (00)12234352 Gold RH
TB Teddy Bear $ 750.00
DB Drone Bmax $ 1,000.00 5 Maria Barry xxxxxxxdddd (00)12263098 Gold RH
DH Doll House $ 2,000.00 6 Sherry Don yyyyyyydddd (01)12745695 Blue DB

Primary Key One toy can be multiple customers’ favourite toy Foreign Key

26

26

Databases

Relational database keys – Foreign key


• They form relationship between the tables within the database
• The foreign key always links to a primary key in another table
• There may be 0, 1 or several foreign keys in a table
• A field that is used to link tables, by linking to a primary key in another table
• The foreign key is used to link tables together by referring to the primary key in another
database table.
• A primary key must be unique, there can be no duplication of attributes in the column chosen
as the primary key for the table. Foreign keys do not have to be unique.

27

27

Databases

Relational database Keys- Example


Email Table • Can this arrangement tell us who sent Email
EmailNum Date Message Num1?
1 2/01/2017 For homework 1, do you want us to provide notes on our references?
2 3/10/2017 My group consists of Swee Lau and Stuart Nelson • Can this arrangement tell us which students
3 3/10/2017 Could you please assign me to a group? visited on 17 Feb?
Student Table
Student
Number Student Name HW1 HW2 MidTerm • Primary key – for each table. What would be
1325 BAKER, ANDREA 88 100 78 the foreign key?
1644 LAU, SWEE 75 90 90
2881
3007
NELSON, STUART
FISCHER, MAYAN
100
95
90
100
98
74
• Why do we also need foreign keys? Query:
3559 TAM, JEFFREY 88 100 88 “Identify all emails sent by Andrea Baker”.
4867 VERBERRA, ADAM 70 90 92
5265
8009
VALDEX, MARIE
ROGERS, SHELLY
80
95
90
100
85
98
• Add a foreign key to “Email” and “Office_Visit”
tables. Query now answered!
Office_Visit Table
VisitID Date Notes • A foreign key is a primary key in another table
2 2/02/2017 Andrea had questions about using IS for raising barriers to entry that enables linking across multiple tables.
3 2/02/2017 Jeffrey is considering his IS major. Wanted to talk about career opportunities
4 2/11/2017 Will miss class Friday due to job conflict

28

28

9
14/4/2025

[E n tity N a m e ]

Relational database Keys- Example

[Presentation Title] | [Date] D a ta b a s e s 29

29

Databases
Relational databases: Model characteristics
Email Table
Student
EmailNum Date Message Number
1 2/01/2008 For homework 1, do you want us to provide notes on our references? 1325
2 3/15/2008 My group consists of Swee Lau and Stuart Nelson 1325
3 3/15/2008 Could you please assign me to a group? 1644 • Three tables “Email”, “Student”, and
“Office_Visit”.
Student Table
Student
Student Name HW1 HW2 MidTerm • Each table contains one or more
Number
1325 BAKER, ANDREA 88 100 78
records – these are the rows of each
1644 LAU, SWEE 75 90 90 table.
2881 NELSON, STUART 100 90 98
3007 FISCHER, MAYAN 95 100 74
• Each record or row contains one or
3559 TAM, JEFFREY 88 100 88 more fields, or characteristics or
4867 VERBERRA, ADAM 70 90 92 attributes (row/record mean the same
5265 VALDEX, MARIE 80 90 85 thing in the context of a relational
8009 ROGERS, SHELLY 95 100 98
database).
Office_Visit Table • The overall database comprises 3
Student tables with attributes and records
VisitID Date Notes Number
2 2/13/2008 Andrea had questions about using IS for raising barriers to entry 1325
3 2/17/2008 Jeffrey is considering his IS major. Wanted to talk about career opportunities 3559
4 2/17/2008 Will miss class Friday due to job conflict 4867
30

30

Databases

Primary and foreign keys – an example


E m a il T a b le
Student
E m a ilN u m D a te M e ssa g e
Number
1 2 /0 1 /2 0 0 8 F o r h o m e w o rk 1 , d o y o u w a n t u s to p ro v id e n o te s o n o u r re fe re n c e s? 1325
2 3 /1 5 /2 0 0 8 M y g ro u p c o n sists o f S w e e L a u a n d S tu a rt N e lso n 1325
3 3 /1 5 /2 0 0 8 C o u ld y o u p le a se a ssig n m e to a g ro u p ? 1644

S tu d e n t T a b le
S tu d e n t
S tu d e n t N a m e HW 1 HW 2 M id T e rm
N um ber
1325 BAKER, AN DREA 88 100 78
P rim ary key 1644 LAU , SW EE 75 90 90 Foreign key
2881 N ELSO N , STU ART 100 90 98
3007 F IS C H E R , M A Y A N 95 100 74
3559 T A M , JE F F R E Y 88 100 88
4867 VERBERRA, ADAM 70 90 92
5265 V A L D E X , M A R IE 80 90 85
8009 RO G ERS, SH ELLY 95 100 98

O ffice _ V isit T a b le
Student
V isitID D a te N o te s
Number
2 2 /1 3 /2 0 0 8 A n d re a h a d q u e stio n s a b o u t u sin g IS fo r ra isin g b a rrie rs to e n try 1325
3 2 /1 7 /2 0 0 8 Je ffre y is c o n sid e rin g h is IS m a jo r. W a n te d to ta lk a b o u t c a re e r o p p o rtu n itie s 3559
4 2 /1 7 /2 0 0 8 W ill m iss c la ss F rid a y d u e to jo b c o n flic t 4867
31

31

10
14/4/2025

[E n tity N a m e ]

Primary and foreign keys – an example

[Presentation Title] | [Date] D a ta b a s e s 32

32

Databases

Primary keys and foreign keys

• Entity = Supplier or Part


• Attribute = Supplier_name, supplier_street, part_name etc.
• Record = an instance of something e.g., in the part table a record is 137 + door latch + 22.00 + 82.59
• Field = a cell, like Dayon, 12.00, Rochester, CMB Inc etc.
• Primary key = Supplier_number (in the Supplier Table)
• Foreign key = Supplier number (in the Part table)
33

33

Databases

Normalization in databases
• Normalization is a method for analysing and reducing a relational database to its most streamlined form
to ensure minimum redundancy, maximum data integrity and optimal processing performance.

• The process of streamlining complex groups of data to minimize redundant data elements and awkward
many-to-many relationships and increase stability and flexibility is called normalisation.

• A properly designed and normalised databased is easy to maintain and minimizes duplicate data.

• Relational database systems enforce referential integrity rules to ensure that relationships between
coupled tables remain consistent.

34

34

11
14/4/2025

Databases

Normalization
Normalization is a process that aims at achieving better designed relational database schemas using

• Functional Dependencies
• Primary Keys

The normalization process takes a relational schema through a series of tests to certify whether it satisfies
certain conditions
• The schemas that satisfy certain conditions are said to be in a given Normal Form
• Unsatisfactory schemas are decomposed by breaking up their attributes into smaller relations that
possess desirable properties (e.g., no anomalies)

In short
W hat – Removing Redundancies and Anomalies
How – Identifying Dependencies and breaking up tables until no anomalies exist
35

35

Databases

Normalization - Overview
1NF 3NF

• Outcome: Identifying non-atomic values from • Outcome: Identifying partial and transitive
relations. dependencies, which helps remove most
• Test: Relation should have no multivalued anomalies
attributes or nested relations. • Test: LHS of any non-trivial FD in F+ is a
superkey, or RHS is a prime attribute.

2NF BCNF
• Outcome: Identifying partial dependencies, • Outcome: Identifying all anomalies at the cost
which helps remove some anomalies. of not preserving all FDs
• Test: LHS of any non-trivial FD in F+ is not a • Test: LHS of any non-trivial FD in F+ is a
proper subset of a candidate key, or RHS is a superkey.
prime attribute

BCNF Ì 3NF Ì 2NF Ì 1NF 36

36

Databases

Normalization – Overview (English version)


1 st Normalisation Form 3 rd Normalisation Form

• Outcome: No repeating groups of data. • Outcome: Any potential secondary keys have
• Test: Data is defined by Primary Key(s). There been removed.
are no repeating of the Key. Each cell contains • Test: No Transitive Dependencies – there is a
only ONE value non-key attribute that can define some of the
other non-key attributes

2 nd Normalisation Form Boyce-Codd Normalisation Form


• Outcome: All non-key attributes are fully • Outcome: Any repeating data is removed but
dependant on its Primary Key. not at the expense of adding more complexity.
• Test: No Partial Dependencies – there is a • Test: Is there any non-trivial data being
composite key, and some data only needs one repeated
part of it.

BCNF Ì 3NF Ì 2NF Ì 1NF 37

37

12
14/4/2025

Databases: Normalization
Example: Student & Lecturer database
Student ID Student Name Course ID Grade Lecturer Lecturer
Address
S01 Max C01 78 Dr Brown St Lucia, 4067
S02 Jack C02 82 Dr Green Taringa, 4069
S03 Julie C03 67 Dr Peter Toowong, 4068
S04 Jane C04 89 Prof. Clark Indooroopilly,
4069

(Rainer and Prince 2020)


39

39

Databases: Normalization
1st Normalisation Form
• There are no repeating groups. • There are no repeating of the Key.
• Data is defined by Primary Key(s). • Each cell contains only ONE value

Student ID Student Course ID Grade Lecturer Lecturer Lecturer


Name Suburb Postcode
S01 Max C01 78 Dr Brown St Lucia 4067
S02 Jack C02 82 Dr Green Taringa 4069
S03 Julie C03 67 Dr Peter Toowong 4068
S04 Jane C04 89 Prof. Clark Indooroopilly 4069

(Rainer and Prince 2020)


40

40

Databases: Normalization
1st Normalisation Form
• There are no repeating groups.
• Data is defined by Primary Key(s).
• There are no repeating of the Key.
• Each cell contains only ONE value

2 nd Normalisation Form
• Outcome: All non-key attributes are fully
dependant on its Primary Key.
• Test: No Partial Dependencies – there is a
composite key, and some data only needs one
part of it.

41

41

13
14/4/2025

Databases: Normalization
2nd Normalisation Form
Student ID Student Name Course ID Lecturer Student ID Course ID Grade
S01 Max C01 Dr Brown S01 C01 78
S02 Jack C02 Dr Green S02 C02 82
S03 Julie C03 Dr Peter S03 C03 67
S04 Jane C04 Prof. Clark S04 C04 89

Lecturer Lecturer Lecturer


Suburb Postcode
A table is in second normal form (2NF) if it meets the Dr Brown St Lucia 4067
following criteria: Dr Green Taringa 4069
• The relation is in first normal form.
• All non-key attributes are functionally dependent on the Dr Peter Toowong 4068
entire primary key. A functional dependency is a one- Prof. Clark Indooroopilly 4069
way relationship between two attributes

(Rainer and Prince 2020) 42

42

Databases: Normalization
2nd Normalisation Form

3 rd Normalisation Form
• Outcome: Any potential secondary keys have
been removed.
• Test: No Transitive Dependencies – there is a
non-key attribute that can define some of the
other non-key attributes

43

43

Databases: Normalization
3rd Normalisation Form
Student ID Student Name Course ID Lecturer Student ID Course ID Grade
S01 Max C01 Dr Brown S01 C01 78
S02 Jack C02 Dr Green S02 C02 82
S03 Julie C03 Dr Peter S03 C03 67
S04 Jane C04 Prof. Clark S04 C04 89

Lecturer Lecturer Suburb Suburb Postcode


Dr Brown St Lucia St Lucia 4067
Dr Green Taringa Taringa 4069
Dr Peter Toowong Toowong 4068
Prof. Clark Indooroopilly Indooroopilly 4069

A table is in third normal form (3NF) if it meets the following criteria:


•The relation is in second normal form (2NF).
•There are no transitive dependencies (example: A=>B AND B=>C, Then A=>C)

(Rainer and Prince 2020) 44

44

14
14/4/2025

Databases: Normalization
3rd Normalisation Form

45

45

[E n tity N a m e ]

Boyce-Codd Normal Form (BCNF)


Student Lecturer Subject
John Smith Shahrzad BISM1201
Mary Jones Keith BISM3222
Mary Jones Shahrzad BISM1201

(Student, Teacher) ⇒ Subject


(Student, Subject) ⇒ Teacher
Teacher ⇒ Subject

[Presentation Title] | [Date] 46

46

[E n tity N a m e ]

Boyce-Codd Normal Form


Student Lecturer Lecturer Subject
John Smith Shahrzad Shahrzad BISM1201
Mary Jones Keith Keith BISM3222
Mary Jones Shahrzad

(Student, Teacher) ⇒ Subject


(Student, Subject) ⇒ Teacher
Teacher ⇒ Subject

[Presentation Title] | [Date] 47

47

15
14/4/2025

[E n tity N a m e ]

Boyce-Codd Normal Form (BCNF) – What’s the problem?


Student Lecturer Lecturer Subject
John Smith Shahrzad Shahrzad BISM1201
Mary Jones Keith Keith BISM3222
Mary Jones Shahrzad Daniel BISM1201

Remerging the data you get…


Boyce-Codd Normalisation Form
Student Lecturer Subject
John Smith Shahrzad BISM1201 • Outcome: Any repeating data is removed but
not at the expense of adding more complexity.
Mary Jones Keith BISM3222
• Test: Is there any non-trivial data being
Mary Jones Shahrzad BISM1201
repeated
John Smith Daniel BISM1201

Mary Jones Daniel BISM1201


[Presentation Title] | [Date] 48

48

Databases: Normalization
Discussion question
Student Bike-Commuter table
Student_id Student_name
245 Bob Smith
265 Xi Wang
987 Anthony Marshall

Bike Storage Building table


Building_id Location Open hours
001 Diamond Building 09:00-17:00
002 Jade Building 06:00-24:00
003 Blue Building 06:00-24:00
004 Gold Building 09:00-17:00

The database table structure above captures Students that commute to the University by bike. Each
student is assigned one Bike Storage Building where they can store their bike and access facilities like
change rooms and a locker. A Bike Storage Building can have many students.

What is the most appropriate Foreign Key and where should we place the Foreign Key in this table
structure so that we can link the two tables?
49

49

Database Management Systems (D B M S)

• Allows users to communicate with a database


• Software for creating, storing, organizing, and accessing data from a
database
• Provides general purpose tools and utilities for producing and extracting
data.
• Enables non-technical users to access data.
• Allows users to create new records in the database, update existing
records in the database, read and display existing records in the
database, and finally, delete an existing record or records within the
database.
• Separates the logical and physical views of the data
- Logical view: how end users view data
- Physical view: how data are actually structured and organized
• Examples: Microsoft Access, DB2, Oracle Database, Microsoft SQL Server,
MySQL, IBM, SAP, Teradata. Microsoft Access is a popular DBMS for
personal computers.

50

50

16
14/4/2025

Database Management Systems (D B M S)

Popular Relational Database Management Systems

Open-Source Relational DBMS for Individuals Relational DBMS for Workgroups


Relational DBMS and Workgroups and Enterprise
MySQL Microsoft Access Oracle
PostgreSQL IBM Lotus Approach IBM DB2
MariaDB Google Base Sybase Adaptive Server
SQL Lite OpenOffice Base Teradata
CouchDB Airtable Microsoft SQL Server
MongoDB Knack Progress OpenEdge

51

51

Database Management Systems (D B M S)

DBMS
• For a user to communicate or talk to the database, both the database and the user must speak the
same language.

• To make this exchange practical in a world where there are thousands of software vendors, and also a
large number of relational database builders, the overall industry has agreed on a standardised
database language.
• This means that we have a standardised language that all databases should implement, and that all
software applications should use.
• This language is called Structured Query Language or, SQL. This language is also the reason for data
independence, that is, we can design software applications without concerning ourselves as to the
internal design details of a relational database.
• For instance, the query: SELECT NAME, EMAIL FROM STUDENT W HERE COURSE = “BISM1201”
AND GRADE IS => B
• Would list all the students taking BISM1201 with a grade higher than a B

52

52

Database Management Systems (D B M S)

Example of what a DBMS does: HR Database with Multiple Views

•The database contains a diverse range of data, e.g. position, net_pay.


•The application software involves two applications, with each used by
a different set of users.
•This demonstrates data independence. Presumably the two
applications have been created in different projects and even by
different vendors. This is not a problem, because the DBMS provides
a single view of the data, and therefore standardized data access.
•Consider the users (employees) e.g. in the payroll office, benefits
office. The DBMS easily accommodates the geographical distribution
of end-users.
• The number of users may also grow e.g., new organization units may
be created. We say that the solution scales well.
•This architecture of the DBMS managing the data minimises many
information challenges.
•Security of data is increased with the application of a single, corporate-
wide information security program. Data integrity, or data correctness
is therefore increased.

53

53

17
14/4/2025

Database Management Systems (D B M S)

Linking Internal Databases to the Web

• A customer wants pricing information


• Customer uses a web browser
• The browser will request information data from the database using HTML
• Because many back-end database cannot interpret commands written in HTML, the web server passes these requests to software that translates HTML
commands into SQL so the DBMS working with the database can process them
• The DBMS sits on the database server
• The DBMS receives the SQL requests and provides the required data
• The information is transferred from the databases back to the web server for delivery on the clients browser.
• The application server takes requests from the web server, runs the business logic to process transactions based on those requests, and provides
connectivity to the organisation’s back-end systems or databases.
54

54

Database Management Systems (D B M S)

Three important operations of a relational DBMS


Select:

• Creates a subset of all records meeting stated criteria

Join:
• Combines relational tables to present the server with more information than is available from individual
tables

Project (display):
• Creates a subset consisting of columns in a table

• Permits user to create new tables containing only desired information

55

55

Database Management Systems (D B M S)

Three Basic Operations of a Relational D B M S

This allows us to set rules about who can


see what information (consider the HR
example)

56

56

18
14/4/2025

Database Management Systems (D B M S)

Capabilities of Database Management Systems


• Data definition capabilities:
- Specify structure of content of database

• Data dictionary:
- An automated or manual file that stores definitions and data elements and their characteristics. MS
Access example captures name, description, size, type, format and other properties. (See example on
page 229).

• Querying and reporting:


- Data manipulation language
- Structured query language (SQL)
- Microsoft Access query-building tools
- Report generation, e.g., Crystal Reports

57

57

Database Management Systems (D B M S)

Example of an S Q L Query
SELECT PART.Part_Number, PART.Part_Name, SUPPLIER.Supplier_Number,
SUPPLIER.Supplier_Name
FROM PART, SUPPLIER
WHERE PART.Suplier_Number = SUPPLIER.Supplier_Number
AND (Part_Number = 137 OR Part_Number = 150);

This query displays Part number, part name, supplier number and supplier name from the PART and SUPPLIER
table, where the there is a match between the supplier number and the Part 137 or Part 150.

SELECT ClientName, Debt


FROM Client
WHERE Debt > 1000
This query displays clients (ClientName) and the amount they owe the company
(Debt) from a database table called Client; the query would only display clients who owe the company more than
$1,000 (WHERE Debt > 1000).
58

58

Database Management Systems (D B M S)

An Access Query

59

59

19
14/4/2025

Database Management Systems (D B M S)


MySQL Workbench example

60

60

More about Databases

Non-relational databases
• “NoSQL”
• Handle large data sets of data that are not easily organized into tables,
columns, and rows
• Use more flexible data model
- Don’t require extensive structuring
• Can manage unstructured data, such as social media and graphics
• E.g. Amazon’s Simple D B, MetLife’s Mongo D B

61

61

More about Databases

Cloud Databases and Distributed Databases


• Relational database engines provided by cloud computing services

- Pricing based on usage


- Appeal to small or medium-sized businesses
• Amazon Relational Database Service
- Offers MySQL, Microsoft SQL Server, Oracle Database engines
• Distributed databases
- Stored in multiple physical locations
- Google’s Spanner cloud service
- Spanner makes it possible to store information across millions of machines in hundreds of
datacentres around the globe, with special time keeping tools to synchronize data precisely in all of
its locations and ensure the data are always consistent. E.g. Google photos uses this, as does
AdWords, and other cloud services.

62

62

20
14/4/2025

More about Databases

Blockchain
• Distributed database of transactions

• Operates on a network without central authority


• Maintains a growing list of records called blocks
• Once recorded, blocks cannot be changed
• Reduces cost of processing transactions and enhances security
• It is yet to be demonstrated that blockchain databases advantage over a centralized database.

63

63

More about Databases


How Blockchain Works
You (a "node") have a file of transactions on your computer (a "ledger"). Two government accountants (let's call them "miners") have the same file on theirs (so
it’s "distributed"). As you make a transaction, your computer sends an e-mail to each accountant to inform them.

Each accountant rushes to be the first to check whether you can afford it (and be paid their salary "Bitcoins"). The first to check and validate hits “REPLY ALL”,
attaching their logic for verifying the transaction ("proof of work"). If the other accountant agrees, everyone updates their file…

This concept is enabled by "Blockchain" technology.

64

64

More about Databases

Relational database vs blockchain


Features Relational database Blockchain
Authority/control Centralised, managed by administrator Decentralised, has no central control
Data handling Create, read, write, delete Read, write
Architecture Client server Distributed ledgers
Integrity Malicious actors can alter data High – supports integrity
Cost Mature technology, easy to maintain Harder to implement and maintain
Transparency Not transparent. Administrator has the power Offers transparency
Chance of failure High Low
Performance High Slow
Data persistence Varies Immutable

65

65

21
14/4/2025

AI-enhanced Database Management


• AI Databases: AI database is a
powerful fusion of AI technologies
within a traditional database system
designed to provide value-added
services. These databases are
specifically targeted at optimizing
computing and database resources,
allowing for the simultaneous
ingestion, exploration, analysis and
visualization of fast-moving, complex
data in milliseconds.
• AI-powered anomaly detection in
databases (fraud prevention)
Fun reading:
https://www.forbes.com/councils/forbest
echcouncil/2024/07/09/what-is-an-ai-
database-the-future-of-data-driven-
decisions/

[Presentation Title] | [Date] 66

66

What to do for next week


Seminar 9 preparation: Databases (check Blackboard for details)

• There is no additional reading for next week. (It is the same as this week)

Tutorial 8 activities (check Blackboard)

67

67

B IS M 1 2 0 1 T ra n s fo rm in g B u s in e s s w ith In fo rm a tio n S y s te m s

Summary of learning objectives


• W hat is a database, and how does a relational database organise data?

• W hat are the characteristics of a relational database and how to structure one?
• W hat are the principles of a database management system?
• W hat are the principal tools and technologies for accessing information from databases to improve
business performance and decision making?

68

68

22
14/4/2025

Thank you. Any questions?


Keith Harbottle | Course Coordinator BISM3222
Business School
[email protected]

facebook.com /uniofqld

Instagram .com /uniofqld

CRICOS code 00025B

69

23

You might also like