0% found this document useful (0 votes)
15 views14 pages

04 - Relational Databases

This document discusses relational databases and their advantages over file-based systems. It defines key terms like DBMS, schemas, and database languages. Relational databases organize data into tables with rows and columns, where each row represents a record and each column a field. Tables are linked using primary and foreign keys. The document outlines best practices for designing normalized relational databases to avoid data errors.

Uploaded by

ashleykiki.ke
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)
15 views14 pages

04 - Relational Databases

This document discusses relational databases and their advantages over file-based systems. It defines key terms like DBMS, schemas, and database languages. Relational databases organize data into tables with rows and columns, where each row represents a record and each column a field. Tables are linked using primary and foreign keys. The document outlines best practices for designing normalized relational databases to avoid data errors.

Uploaded by

ashleykiki.ke
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/ 14

Chapter 4

Relational Databases
4-1
Learning Objectives

 Explain the importance and advantages of databases.

 Describe the difference between database systems and file-based legacy systems.

 Explain the difference between logical and physical views of a database.

 Explain fundamental concepts of database systems such as DBMS, schemas, the data dictionary, and
DBMS languages.

 Describe what a relational database is and how it organizes data.

 Create a set of well-structured tables to store data in a relational database.

 Perform simple queries using the Microsoft Access database.

4-2
Data Hierarchy

 Field
 Attributes about
an entity

 Record
 Related group of
fields

 File
 Related group of
records

 Database
 Related group of
files

4-3
Advantages of Database Systems
 Data Integration
 Files are logically combined and made accessible to various systems.

 Data Sharing
 With data in one place it is more easily accessed by authorized users.

 Minimizing Data Redundancy and Data Inconsistency


 Eliminates the same data being stored in multiple files, thus reducing inconsistency in
multiple versions of the same data.

 Data Independence
 Data is separate from the programs that access it. Changes can be made to the data
without necessitating a change in the programs and vice versa.

 Cross-Functional Analysis
 Relationships between data from various organizational departments can be more easily
combined.

4-4
Database Terminology

 Database Management System (DBMS)


 Interface between software applications and the data in files.

 Database Administrator (DBA)


 Person responsible for maintaining the database

 Data Dictionary
 Information about the structure of the database
 Field names, descriptions, uses

4-5
Logical vs. Physical

 Physical View
 Depends on explicitly knowing:
 How is the data actually arranged in a file
 Where is the data stored on the computer

 Logical View
 A Schema separates storage of data from use of the data
 Unnecessary to explicitly know how and where data is stored.

4-6
Schemas

 Describe the logical structure of a


database
 Conceptual Level
 Organization wide view of the
data
 External Level
 Individual users view of the data
 Each view is a subschema
 Internal Level
 Describes how data are stored
and accessed
 Description of: records,
definitions, addresses, and
indexes

4-7
DBMS Languages

 Data Definition Language (DDL)


 Builds the data dictionary
 Creates the database
 Describes the subschema
 Specifies record or field security constraints

 Data Manipulation Language (DML)


 Changes the content in the database
 Updates, insertions, and deletions

 Data Query Language (DQL)


 Enables the retrieval, sorting, and display of data from the database

4-8
Relational Database

 Relational data model represents the conceptual and external level


schemas as if data are stored in tables.

 Table
 Each row, a tuple, contains data about one instance of an entity.
 This is equivalent to a record
 Each column contains data about one attribute of an entity.
 This is equivalent to a field

4-9
Row (Record) A Relational Table

Each row contains multiple attributes Same type of data


describing an instance of the entity. In
Column (Field)
this case, inventory.

4-10
Attributes

 Primary Key
 An attribute or combination of attributes that can be used to uniquely
identify a specific row (record) in a table.

 Foreign Key
 An attribute in one table that is a primary key in another table.
 Used to link the two tables

4-11
Database Design Errors

 If database is not designed properly data errors can occur.


 Update Anomaly
 Changes to existing data are not correctly recorded.
 Due to multiple records with the same data attributes
 Insert Anomaly
 Unable to add a record to the database.
 Delete Anomaly
 Removing a record also removes unintended data from the database.

4-12
Design Requirements for Relational Database

1. Every column must be single valued.

2. Primary keys must contain data (not null).

3. Foreign keys must contain the same data as the primary key in
another table.

4. All other attributes must identify a characteristic of the table


identified by the primary key.

4-13
Normalizing Relational Databases

 Initially, one table is used for all the data in a database.

 Following rules, the table is decomposed into multiple tables related


by:
 Primary key–foreign key integration

 Decomposed set of tables are in third normal form (3NF).

4-14

You might also like