Date post: | 16-Dec-2015 |
Category: |
Documents |
Upload: | skyler-bennis |
View: | 226 times |
Download: | 4 times |
Supplement 01 (a) Database-Introduction-1
Supplement 01aDatabase-Introduction-1
HSQ - DATABASES & SQL
And Franchise Colleges
By MANSHA NAWAZ
Supplement 01 (a) Database-Introduction-1
Why Database Systems?• Data is one of the most important resources in ALL
organisations. Without data it is not possible to operate.• Control manufacturing processes?• Process sales of goods?• Diagnose patients’ illnesses?• Forecast sales?• Run the University of Teesside?
• To be useful data must be processed into information. It must be:
• Accurate• Timely• Relevant
• Therefore, you need adequate facilities for storing data and processing information:– Storing (and verifying) data– Manipulating data– Extracting data
Supplement 01 (a) Database-Introduction-1
File - based approach
ApplicationData Department
Stock Control
Production
Accounts
Part No, Supplier, qtylocation, reorder qty
Stores
Operations
Finance
Part#, qty, Assy#,Machine#, Cert.#:
Supplier, Part#, Part#, Cost, Qty
• From the earliest days computers were used to store files of data. • Separate systems, ie separate files and programs, were developed for each
application, eg stock files, production files, accounts files, etc.• Applications processed the data to provide information.
Problems
Inconsistency
Redundancy
Lack of integration
Lack of control
Supplement 01 (a) Database-Introduction-1
Database approach
Application
Database
Supplier, Supplier Pt No:, Part No:
Cost, Qty ordered, Qty del., qty, Assy No:,
Machine No:, Cert. No: location, reorder qty
Database Management
SystemDBMS
Stock Control
Production
Accounts
Department
• DBMS is the environment used to manage a database• The database consisting of stored data and processed information for a system
• Data are organised into a single set of underlying TABLES from which the applications draw the data to provide information that are relevant to them.
Supplement 01 (a) Database-Introduction-1
E-R Model NF
Systems Analysis & Design DFD DataStores, DataFlows and Data Dictionary
DBMS
PHYSICAL VIEW OF DATATABLES
LOGICAL VIEW OF DATAFORMS
DATA MODEL
TABLE SET
Database connectivity via websites
www .net technologyMacromedia Dreamweaver
MS Visual Studio
Database connectivity via desktop DBMS such as
MS Access
Database connectivity via programming
languages such as MS Visual Basic
Area of Interest
Database Development
Supplement 01 (a) Database-Introduction-1
Client/Server Architecture
User Workstation
User Workstation
OperatorWorkstation
DepartmentFile-Servers
Corporate Servers
• Server provides services for the Clients which are responsible for interacting with the users (Input/Output)
• Server is responsible for performing a service (e.g. transaction) and guaranteeing the integrity of the data
• Well suited for distributed systems handling large amounts of data
Supplement 01 (a) Database-Introduction-1
System Development Overview• Systems development undertaken by using Case Tools
– used early in development life cycle – Provide requirements and design in terms of Systems Model and Data Model
• Case Tools for Systems Modelling:– Dataflow Diagrams (DFD)– Data Dictionary (DD)
• Case Tools for Data Modelling:– Normalisation (NF) – A rules based technique undertaken to produce the data model for a system– Entity Relationship Model (ER) – A diagrammatic based technique undertaken to produce the data model for a system – DFD & DD provide us with the base for a ERD Data Model
• Data Model – Can be implemented on a DBMS such as MS SQL Server, MS Access, etc– Consists of logical and physical view of the proposed systems data.
• DBMS – implementation platform – Database Management System such as MS SQL Server 2000 (MS Access)
Supplement 01 (a) Database-Introduction-1
• MS SQL Server is a server based database.
• Multi User – Multi Platform Systems
• Large, high volume traffic database systems
• Server holds database. Workstation provides access.
• For web or database systems if the access traffic is likely
to generate more than 20 concurrent database hits at a
time, it's time to move to a database server
• Generally, database servers like MS SQL Server are the
way to go for database or web/database systems
• Many and wide ranging user base for system
• Additional Security and Login features
• MySQL (free sql database used for connectivity to Websites via
PHP).
MS SQL Server V MS Access• MS Access is
Desktop based
• Small, low-traffic database systems
• Small, low-traffic web sites requiring database connectivity.
• Cannot handle heavy traffic from multiple users.
Supplement 01 (a) Database-Introduction-1
Advantages of the Database Approach
• No unnecessary duplication of data.• Greater consistency of data.• Wider availability of data.• Greater flexibility of use of data.• Improved data integrity.• Improved security.• Improved backup and recovery services.• Can change the data structure without altering associated
programs.• A database is dynamic: it can grow and change.• Data management can be more consistent and systematic.
Supplement 01 (a) Database-Introduction-1
Databases• “A shared collection of logically related data, and a
description of this data, designed to meet the information needs of an organisation.”‘Database Systems’ by Connolly & Begg Addison-Wesley, ISBN 0-201-70857-4
• “A database system can be thought of as a computerised record-keeping system. Such a system involves the data itself (stored in the database), hardware, software and – most important! – users.
• … Databases are integrated and (usually) shared; they are used to store persistent data.”‘An Introduction to Database Systems’ by C J Date, Addison-Wesley, ISBN 0-201-
38590-2 (7th Edition, 2000)
Supplement 01 (a) Database-Introduction-1
DBMS
• “A software system that enables users to define, create, maintain, and control access to the database.”
• Provides the interface between the user and the data in the database.
• Allocates storage to data and maintains indices so that any required data can be retrieved.
• Protects data against unauthorised access.• Safeguards data against corruption.• Provides recovery and restart facilities after a hardware or
software failure.
Supplement 01 (a) Database-Introduction-1
• Also referred to as Conceptual Model– A Data Model provides a particular way of thinking about data, at least in terms of its structure – Data Models include data descriptions, data relationships, data semantics, consistency constraints [Silberschatz et. al.] – Data model comprises three components: data structures, data manipulators, and general integrity rules [Codd (1970)]
• A Data Model is implementation independent– Not aimed at any particular computer software or hardware.
• DBMS supports an implementation of one or more Data Models– What data model is supported by a Relational Database Management System (Access, SQL, Oracle, etc.)– A RDBMS may have extensions to support other models.
• At what stage in the Systems Development Lifecycle will data modelling take place (early, middle, late)?
Data Model
Supplement 01 (a) Database-Introduction-1
– Data Models produced early in Systems Development
– Makes improvements in terms of : • NO DUPLICATION or REDUNDANT or NULL INFORMATION• REDUCTION IN PHYSICAL SIZE• QUICKER INFORMATION RETRIVAL
• LEADS TO A FULLY OPTIMISED SET OF TABLES
– Data Model produced by Case Tools techniques • Normalisation
– Rule based technique for transfering logical datastore view to physical view
• Entity Relationship Modelling. – Diagrammatic representation of a proposed systems database requirements
– Data Model provides • a full set of related tables and data
• Able to derive physical views (internal schema) of data
• Able to derive logical views (external schema) of data
Data Model
Supplement 01 (a) Database-Introduction-1
• Provide us with a Bottom Up approach to producing the database tables
• Technique covered in other modules
• Supplement on Normalisation is provided on the DD website
Normalisation (NF)
Entity Relationship Modelling (ERM)
• A data modelling CASE Tool Technique of interest• A diagrammatic representation of a systems database tables• Top Down approach to data modelling• Entity Relationship Diagram (ERD) used to map data model • Applying rules, translate ERD into a set of well-normalised tables• Provides both logical and physical view of tables
Supplement 01 (a) Database-Introduction-1
– TABLES– DATA
– Internal Schema View – database structure view that a DBMS requires.– in terms of Tables, Attributes (data fields) and Types (data defn.)– linkage between tables via primary and foreign keys – All Datastores decomposed to a set of TABLES– Physical View – for Designers
PHYSICAL VIEW
– FORMS– INFORMATION
– External Schema View– Form or Screen views provided to the end user.– A set of FORMS derived from the TABLES– Logical View – for Users
LOGICAL VIEW
Supplement 01 (a) Database-Introduction-1
The Three Level ANSI-SPARC Architecture
• In 1975 the ANSI Standards Planning and Requirements Committee proposed a standard terminology and general architecture for database systems.
• The objective is to separate each user’s view of the database from the way it is physically represented. 3 levels or views of data within a database:
• External Level– The users’ view of the database. Also known as the applications view.
• Conceptual Level – The overall view of the database. Also known as the global view.
• Internal Level– The physical representation of the database on the computer. Also
known as the storage view.
Supplement 01 (a) Database-Introduction-1
Schemas
• The overall description of the database is called the database schema. There are 3 different types of schema in the database.
• External Schema– There are multiple external schemas (or subschemas), each one
corresponding to a different view of the data.• Conceptual Schema
– There is one conceptual schema, which describes the data stored in the database, the relationships and the integrity constraints.
• Internal Schema– There is one internal schema, which describes how the data are stored
in the database and how they are accessed.
Supplement 01 (a) Database-Introduction-1
Schemas and Views
Inventory
H R
Finance
Production
Customer Service
Conceptual
Internal
External
External
Supplement 01 (a) Database-Introduction-1
Mapping• Provides the translation between the schemas at different levels. The DBMS is responsible
for mapping between the 3 types of schema.
• The DBMS must ensure that each external schema is derivable from the conceptual schema.
• The DBMS must use the information in the conceptual schema to map between each external schema and the internal schema.
Supplement 01 (a) Database-Introduction-1
Data Independence
• A major objective for the 3-level architecture is to provide data independence, ie upper levels must be unaffected by changes to lower levels.
• There are 2 kinds of data independence:
• Logical data independence
– refers to the immunity of the external schemas to changes in the conceptual schema.
– It should be possible to alter tables, columns or relationships without having to alter existing external schemas or rewrite application programs (other than those that are directly affected).
• Physical data independence
– refers to the immunity of the conceptual schema to changes in the internal schema.
– It should be possible to alter file organizations, storage devices, indexes, etc, without having to alter the conceptual or external schemas.
Supplement 01 (a) Database-Introduction-1
The Systems Catalogue
• The database schema is defined using a special language called a Data Definition Language (DDL).
• The result of the compilation of the DDL statements is a set of tables stored in special files collectively called the system catalog.
• This is a repository of meta-data (data about data), ie information describing the data in the database, typically containing the name, description, source and usage information for each data item.
• The system catalog is also known as the data dictionary or the data directory.
Supplement 01 (a) Database-Introduction-1
Database Language
• A Data Definition Language (DDL) is used to specify the data in the database.
• A Data Manipulation Language (DML) is used to access the data.• A Data Control Language (DCL) is used to control access to the data.• Some databases have a combined DDL, DML and DCL (often called a
Query Language), eg SQL.
Supplement 01 (a) Database-Introduction-1
Database Types - 3 Main Data Models
• Each database uses a definition language
– imposes restrictions on • what can be defined• how entities relate to each other
Network model
Hierarchical model
Relational model
Supplement 01 (a) Database-Introduction-1
Database Types - Network
Part No:
Supplier Name
Supplier Part No:
Link File
Can show all 1:n relationships between records
Supplement 01 (a) Database-Introduction-1
Database Types - Hierarchical
Supplier Part No:Supplier CodeLocation
Electrical Steel Oils Fasteners
QuantitySupplier Name
STOCK
Part No:
Supplement 01 (a) Database-Introduction-1
Data Files STOCK ITEM
RECORD
STOCK ITEMSTOCK ITEMSTOCK ITEMFILE
FIELD(S)
Part No:
Colour
Weight
Description
QuantityReorder Qty
Location Supplier NameSupplier Code
Supplier Part No:
12345
N/A
98
F37
Cadmium Bar 90mm dia
74
FerrisF2
c801
12345
FIELD VALUESKEY FIELD
PRIMARYKEY
Database Types - Relational
Supplement 01 (a) Database-Introduction-1
Logical vs. Physical
STOCK ITEMSTOCK ITEMSTOCK ITEM
FIELD(S)
Part No:
Colour
Weight
Description
QuantityReorder Qty
Location Supplier NameSupplier Code
Supplier Part No:
12345
N/A
98
F37
Cadmium Bar 90mm dia
74
FerrisF2
c801
12345
FIELD VALUES
LOGICAL
PHYSICAL
Database Types - Relational
Supplement 01 (a) Database-Introduction-1
Relationships - 1:1
STOCK ITEMSTOCK ITEMSTOCK ITEM
Part No:
Colour
Weight
Description
QuantityReorder Qty
LocationSupplier Code
12345
N/A
98
F37
Cadmium Bar 90mm dia
74
FerrisF2
c801
12345
Supplier Name
Supplier Part No:
Supplement 01 (a) Database-Introduction-1
Relationships - 1:n
STOCK ITEMSTOCK ITEMSTOCK ITEM
Part No:
Colour
Weight
Description
QuantityReorder Qty
Location Supplier NameSupplier Code
12345
N/A
98
F37
Cadmium Bar 90mm dia
74
FerrisF2
c801
12345
Supplier Part No:
Supplement 01 (a) Database-Introduction-1
Relationships - m:n
STOCK ITEMSTOCK ITEMSTOCK ITEM
Part No:
Colour
Weight
Description
QuantityReorder Qty
Location Supplier NameSupplier Code
12345
N/A
98
F37
Cadmium Bar 90mm dia
74
FerrisF2
c801
12345
Supplier Part No: