9 - Ansi Sparc-2016
9 - Ansi Sparc-2016
9 - Ansi Sparc-2016
CSCU9Q5 • The limitations of the file-based approach can be attributed to two factors:
– The definition of the data is embedded in the programs which are used
rather than being stored separately and independently.
Database Principles and Applications – There is no control over the access and manipulation of data beyond
that imposed by the programs.
3 4
Recap: The Database Management System Recap: The Database Management System
• The Database Management System (DBMS) is the software that enables users • The fact that the database provides a central storage repository for data allows
to define, create, and maintain the database and which provides controlled the DML to provide a general enquiry facility for this data, called a query
access to this database. language.
– Query languages help prevent the problems of either a fixed set of
• The DBMS comes between the users and the database.
operations or a proliferation of programs that occur with file-based
systems.
• First, the DBMS allows users to define the database, usually through a Data
Definition Language (DDL).
• The DBMS provides controlled access to the database.
– The DDL allows users to specify the data types and structures, and the
– Prevents access by unauthorised users.
constraints on the data to be stored in the database.
– Protects integrity of data by maintaining its consistency.
• Second, the DBMS allows users to insert, update, delete, and retrieve data
– Controls access to allow sharing.
from the database, usually through a Data Manipulation Language (DML).
– Facilitates recovery following hardware or software failures.
5 6
7 8
– an internal level.
9 10
– Each user should be able to access the same data, but have a different • 4. The internal structure of the database should be unaffected by
customised view of the data. These should be independent: changes to one changes to the physical aspects of the storage.
view should not affect others.
– For example, a changeover to a new disk.
• 2. It hides the physical storage details from users.
• 5. The database administrator should be able to change the conceptual
– Users should not have to deal with physical database storage details. They or global structure of the database without affecting the users.
should be allowed to work with the data itself, without concern for how it
is physically stored. – This should be possible while still maintaining the desired individual
users’ views.
• More ...
11 12
the computer (and may be specified in some programming language). Sno Fname Lname Age Salary StaffNo Lname Bno
– There may be many external schemas for a given database. • Each external schema is related to the conceptual schema by the
external/conceptual mapping.
• The conceptual schema describes all the data items and relationships
between them, together with integrity constraints (later). • This enables the DBMS to map data in the user’s view onto the
relevant part of the conceptual schema.
– There is only one conceptual schema per database.
• A conceptual/internal mapping relates the conceptual schema to the
• At the lowest level, the internal schema contains definitions of the internal schema.
stored records, the methods of representation, the data fields, and
• This enables the DBMS to find the actual record or combination of
indexes.
records in physical storage that constitute a logical record in the
– There is only one internal schema per database. conceptual schema.
17 18
Conceptual/Internal • The internal level contains a physical description of the structure for
mapping the conceptual record expressed in a high-level language.
Struct STAFF {
int StaffNo;
• Note that the order of the fields in the physical structure is different
int BranchNo; from that of the conceptual record.
Internal Level char Fname[15];
char Lname[15];
struct date DateOfBirth;
• The physical structure contains a “pointer”, next. This will be simply
float Salary; the memory address at which the next record is stored. Thus the set of
struct STAFF *next; // pointer to next record staff records may be physically linked together to form a chain.
};
19 20
27 28
29