The database is the underlying framework of the information system. Relational Database Management Systems (DBMSs) is the predominant system for business applications at present.
MIST811: Week 3
3.1 Introduction
A database is a collection of related data. The Database Management System (DBMS) is the software that manages and controls access to the database. A database application is a program that interacts with the database at some point of its execution. The database system is a collection of application programs that interact with the database along with the DBMS and the database itself. More accurate definitions will be provided later.
MIST811: Week 3 2
Examples
Purchases from a supermarket
Bar code reader to scan each purchase. Bar code reader is linked to an application program that uses the bar code to find out the price of the item from a product database. This program reduces the number of such items in stock and displays the price on the cash register. If the reorder level falls below a specified threshold, the database system may automatically place an order to obtain more stocks of that item.
MIST811: Week 3
Examples ctd
Purchases using your credit card
Assistant normally checks you have sufficient credit left to make the purchase. This can be done on the telephone or may be done automatically by a card reader linked to a computer system. There is a database somewhere that contains information about the purchases you have made on your credit card. To check your credit there is a database application program that uses your credit card number to check that the price of the goods you wish to buy together with the sum of the purchases you have already made this billing period is within your credit limit.
MIST811: Week 3 4
Examples ctd
Booking a holiday using a travel agency
When you make enquiries about a holiday, the travel agent may access several databases containing holiday and flight details. When you book the holiday, the database system has to make all the necessary booking arrangements.
The system has to ensure that two different agents do not book the same holiday or overbook the seats on a flight.
The travel agent may have another, usually separate, database for invoicing.
MIST811: Week 3
MIST811: Week 3
10
DreamHome Example The Sales Department is responsible for selling and renting property. The form that landlord has to fill out before property is marketed for rent is given on next slide.
This gives details of rental property as well as owner (landlord) details.
MIST811: Week 3 12
Figure 3.1
MIST811: Week 3
13
MIST811: Week 3
15
PrivateOwner
MIST811: Week 3
16
Client
MIST811: Week 3
17
Figure 3.3
MIST811: Week 3
19
10
Figure 3.4
Lease file
PropertyForRent file
MIST811: Week 3
21
Lease file
MIST811: Week 3
22
11
Sales Files PropertForRent (propertyNo, street, city, postcode, type, rooms, rent, ownerNo) PrivateOwner (ownerNo, fName, lName, address, telNo) Client (clientNo, fName, lName, address, telNo, prefType, maxRent)
MIST811: Week 3 24
12
Contract Files Lease (leaseNo, propertyNo, clientNo, rent, paymentMethod, deposit, paid, rentStart, rentFinish, duration) PropertyForRent (propertyNo, street, city, postcode, rent) Client (clientNo, fName, lName, address, telNo)
MIST811: Week 3 25
DreamHome Example ctd There is a significant amount of duplication of data in the two departments. This duplication of data is generally true of file-based systems.
MIST811: Week 3
26
13
14
Uncontrolled duplication of data is undesirable It is wasteful. It costs time and money to enter the data more than once. It takes up additional storage space which has costs attached. Often duplication can be avoided by sharing files. Duplication can lead to loss of data integrity; the data is no longer consistent.
MIST811: Week 3 29
MIST811: Week 3
30
15
The structure of files is embedded in the applications program. The structures are dependent on the application programming language.
Example: The structure of a file generated by a COBOL program may be different from the structure of a file generated by a `C program. The direct incompatability of such files makes them difficult to process jointly. They need to be converted to some common format to facilitate processing.
MIST811: Week 3 31
16
MIST811: Week 3
34
17
MIST811: Week 3
35
The database
The database and the Database Management System (DBMS) were developed to overcome these limitations.
DEFN: The database is a shared collection of logically related data, and a description of this data, designed to meet the information needs of an organisation.
The database is a single, possibly large, repository of data that can be used simultaneously by many departments and users, All data items are integrated with a minimum amount of duplication.
MIST811: Week 3 36
18
MIST811: Week 3
37
19
MIST811: Week 3
40
20
MIST811: Week 3
42
21
DBMS ctd
A DBMS usually provides the following facilities It allows users to define the database, usually through a Data Definition Language (DDL). The DDL allows users to specify the data types and structures and the constraints on the data to be stored in the database.
MIST811: Week 3 44
22
DBMS ctd
It allows users to insert, update, delete, and retrieve data from the database, usually through a Data Manipulation Language (DML). Having a central repository for all data and data descriptions allows the DML to provide a general inquiry facility to this data, called a query language. The most common query language is the Structured Query Language (SQL).
MIST811: Week 3 45
MIST811: Week 3
46
23
DBMS ctd
A concurrency system which allows shared access to the database; A recovery system which restores the database to a previous consistent state following a hardware or software failure; A user-accessible catalogue which contains descriptions of the data in the database.
MIST811: Week 3 47
DBMS ctd
DEFN: The Application Program is a computer program that interacts with the database by issuing an appropriate request (typically an SQL statement) to the DBMS. Users interact with the database through a number of application programs that are used to create and maintain the database and to generate information. The application programs may be written in some programming language or in some higher-level fourth-generation language.
MIST811: Week 3 48
24
Figure 3.7
Views
DEFN: A view is some subset of the database. It allows users to see the data the way they want to see it. Benefits of views: Provide a level of security. Can exclude data that some users should not see. Provide a mechanism to customize the appearance of the database, Can present a consistent, unchanging picture of the structure of the database even if the underlying database is changed.
MIST811: Week 3 50
25
MIST811: Week 3
51
Hardware
Needed for DBMS and the applications to run on. Can range from a single personal computer, to a single mainframe, to a network of computers. Depends on the organizations requirements and the DBMS used. A DBMS requires a minimum amount of main memory and disk space to run, but this minimum may not give acceptable performance. The frontend is the part of the DBMS that interfaces with the user. This is called client-server architecture: the backend is the server and the frontends are the clients.
MIST811: Week 3
52
26
Software
Made up of DBMS software and the application programs, together with operating system, including network software if the DBMS is being used over a network. Application programs may be written using a fourth-generation language like SQL embedded in a third generation language.
MIST811: Week 3 53
Data
From the end-users point of view data is the most important component of the DBMS environment. Data is the bridge between the machine components and human components. The database contains both the operational data and the metadata (data about data). The structure of the database is called the schema.
MIST811: Week 3 54
27
Data ctd
Figure 3.7 on earlier slide is a schema consisting of four files (or tables): PropertyForRent, PrivateOwner, Client, Lease.
PropertyForRent table has 8 fields or attributes: propertyNo, street, city, postcode, type (the property type), rooms (the number of rooms), rent (the monthly rent), ownerNo. ownerNo attribute models the relationship between PropertyForRent and PrivateOwner (the owner Owns the property for rent), see Figure 3.6.
MIST811: Week 3
55
Procedures
Procedures are instructions and rules that govern the design and use of the database. Documented procedures on how to run the system are required by the users of the system and the staff that manage the database. Procedures may consist of instructions on how to:
log on to the DBMS; use a particular DBMS facility or application program; start and stop the DBMS; change the structure of a table.
MIST811: Week 3 56
28
People
There are four distinct types of people: data and database administrators, database designers, application developers, and end-users.
MIST811: Week 3
57
29
Database Designers
Large database design projects have two types of designer
Logical database designer: identifies the data (the entities and attributes), the relationships between the data, and the constraints on the data that is to be stored in the database. Physical database designer: decides how the logical database design is to be physically realized.
MIST811: Week 3 60
30
Application Developers
People who implement the application programs that provide the required functionality for the end-users. Usually application developers work from a specification produced by systems analysts. Each program contains statements that request the DBMS to perform some operations on the database including retrieving data, inserting, updating, and deleting data.
MIST811: Week 3 61
End-Users
End-users are the clients for the database, which has been designed and implemented, and is being maintained to serve their information needs. End-users can be classified according to the way they use the database system:
Nave users: access database through specially written application programs that attempt to make the operations as simple as possible. Sophisticated users: knows the structure of the database and facilities offered by the DBMS. May use a high-level query language like SQL to perform the required operations or may even write application programs for their own use.
MIST811: Week 3 62
31
Second-generation
Relational model proposed by E.F. Codd in 1970. SQL is the standard language for for relational DBMSs.
Third-generation
Object-Oriented Object-Relational
MIST811: Week 3 63
32
33
3.6.1 Terminology
Relation: A relation is a table with columns and rows. Attribute: An attribute is a named column of a relation. Domain: A domain is the set of allowable values for one or more attributes. Tuple: A tuple is a row of a relation. Degree: The degree of a relation is the number of attributes it contains. Cardinality: The cardinality of a relation is the number of tuples it contains. Relational database: A collection of normalized* relations with distinct relation names. *(More on this in a later lecture.)
MIST811: Week 3 68
34
Alternative terminology
Formal terms Relation Tuple Attribute Alternative 1 Table Row Column
MIST811: Week 3
35
Integrity Constraints
Null: Represents a value for an attribute that is currently unknown or is not applicable for this tuple. Base relation: A named relation corresponding to an entity in the conceptual schema, whose tuples are physically stored in the database. Entity Integrity: In a base relation, no attribute of the primary key can be null. Referential Integrity: If a foreign key exists in a relation, either the foreign key value must match a candidate key value of some tuple in its home relation or the foreign key must be wholly null.
MIST811: Week 3 72
36
3.6.3 Views
View: The dynamic result of one or more relational operations operating on the base relations to produce another relation. A view is a virtual relation that does not necessarily exist in the database but can be produced upon request by a particular user, at the time of request. Views provide a powerful and flexible security mechanism by hiding parts of the database from certain users. Views permit users to access data in a way that is customised to their needs. Views can simplify complex operations on the base relations.
MIST811: Week 3 73
37
a) How would a file based approach be implemented? b) In what ways would a DBMS help this organisation? c) What data can you identify that needs to be represented in the database?
where Hotel contains hotel details and hotelNo is the primary key; Room contains room details for each hotel and (roomNo,hotelNo) forms the primary key; Booking contains details of bookings and (hotelNo,guestNo,dateFrom) forms the primary key; Guest contains guest details and guestNo is the primary key.
MIST811: Week 3 76
38
HOMEWORK: Submit answers to 1a) 1b), 1c), 1d), 2a), 2b) to ERIC by 6pm Monday 17 March 2008.
MIST811: Week 3 77
Readings
Chapter 1: An Overview of Database Management in An Introduction to Database Systems (8th edition), Addison-Wesley, 2004 by C. J. Date. (QA76.9.D3 D3659 2004) Chapter 1: Introduction to Databases in DATABASE SYSTEMS A Practical Approach to Design, Implementation, and Management (FOURTH EDITION), Addison Wesley, 2005 by Thomas Connolly and Carolyn Begg. (QA76.9.D26 C66 2005)
MIST811: Week 3 78
39