introduction –all information systems create, read, update and delete data. this data is stored in...
TRANSCRIPT
Introduction
– All information systems create, read, update and delete data. This data is stored in files and databases.
• Files are collections of similar records. • Databases are collections of interrelated files.
– The key word is interrelated. – The records in each file must allow for relationships (think of
them as ‘pointers’) to the records in other files.
– In the file environment, data storage is built around the applications that will use the files.
– In the database environment, applications will be built around the integrated database.
Fields
• Fields are common to both files and databases.– A field is the implementation of a data
attribute. • Fields are the smallest unit of meaningful data to be
stored in a file or database.
Fields (cont.)
• There are four types of fields that can be stored: primary keys, secondary keys, foreign keys, and descriptive fields.– Primary keys are fields whose values identify
one and only one record in a file.– Secondary keys are alternate identifiers for an
database. • A single file in a database may only have one primary
key, but it may have several secondary keys.
Fields (cont.)
– Foreign keys are pointers to the records of a different file in a database.
• Foreign keys are how the database ‘links’ the records of one type to those of another type.
– Descriptive fields are any other fields that store business data.
Records
• Fields are organized into records.
• Like fields, records are common to both files and databases.– A record is a collection of fields arranged in a
predefined format.
Files and Tables
• Similar records are organized into groups called files.– A file is the set of all occurrences of a given
record structure.
• In database systems, a file corresponds to a set of similar records; usually called a table.– A table is the relational database equivalent of
a file.
Databases
– Databases provide for the technical implementation of entities and relationships.
– The history of information systems has led to one inescapable conclusion:
• Data is a resource that must be controlled and managed!
– Out of necessity, database technology was created so an organization could maintain and use its data as an integrated whole instead of as separate data files.
A legacy file-based
information system
(built in-house)
File
FileInformation
System
(built in-house)
Information System
(built in-house)
Operational Database
File
File
Information System
(built in-house)
A legacy file-based
information system
(purchased)
File
File
File
Information System
(purchased)
Operational Database
Data Warehouse
End-User Tools
End-User Applications
Personal DB
Work-Group Database
Users and Programmers
Users and Programmers
Users and Programmers
Users and Programmers
Users
End-User Work Group
Relational Database Management SystemsRelational Database Management Systems:
• Relational databases implement data in a series of tables that are ‘related’ to one another via foreign keys.– Files are seen as simple two-dimensional tables,
also known as relations. – The rows are records.– The columns correspond to fields.
Customers TableCustomer Number Customer Name Customer
Balance…
10112 Luck Star 1455.7710113 Pemrose 12.1410114 Hartman 0.0010117 K-Jack Industries - 20.00
OrdersTableOrderNumber
Customer Number(foreign key)
…
A633 10112A634 10114A635 10112
Ordered Products TableOrderNumber(foreignkey)
Product Number(foreign key)
QuantityOrdered
…
A633 77F02 1A633 77B12 500A634 77B13 100A634 77F01 5A635 77B12 300A635 77B15 15
Products TableProduct Number Product Description Quantity
in Stock…
77B12 Widget 800077B13 Widget 077B15 Widget 5277F01 Gadget 2077F02 Gadget 2
• The query language of most relational databases is called SQL (which stands for Structured Query Language). – SQL supports not only queries, but complete
database creation and maintenance. – A fundamental characteristic of relational SQL
is that commands return ‘a set’ of records, not necessarily just a single record (as in non-relational database and file technology).
– SELECT specific records from a table based on specific criteria (e.g. SELECT CUSTOMER WHERE BALANCE > 500.00)
– PROJECT out specific fields from a table (e.g. PROJECT CUSTOMER TO INCLUDE ONLY CUSTOMER_NUMBER, CUSTOMER_NAME, BALANCE)
– JOIN two or more tables across a common field – a primary and foreign key (JOIN CUSTOMER AND ORDER USING CUSTOMER_NUMBER)
Query by example