1 / 31

HSQ - DATABASES & SQL

HSQ - DATABASES & SQL. And Franchise Colleges. Supplement 01a Database-Introduction-1. By MANSHA NAWAZ. 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?

dixon
Download Presentation

HSQ - DATABASES & SQL

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. HSQ - DATABASES & SQL • And Franchise Colleges Supplement 01aDatabase-Introduction-1 • By MANSHA NAWAZ Database-Introduction-1

  2. 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 Database-Introduction-1

  3. File - based approach • 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. Data Application Department Part No, Supplier, qty location, reorder qty Stores Stock Control Problems Inconsistency Redundancy Lack of integration Lack of control Part#, qty, Assy#, Machine#, Cert.#: Production Operations Supplier, Part#, Part#, Cost, Qty Finance Accounts Database-Introduction-1

  4. Database approach • 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. Application Department Stock Control Database Database Management System DBMS Supplier, Supplier Pt No:, Part No: Cost, Qty ordered, Qty del., qty, Assy No:, Machine No:, Cert. No: location, reorder qty Production Accounts Database-Introduction-1

  5. Database Development Systems Analysis & Design DFD DataStores, DataFlows and Data Dictionary DATA MODEL TABLE SET NF E-R Model DBMS PHYSICAL VIEW OF DATA TABLES LOGICAL VIEW OF DATA FORMS Database connectivity via websites www .net technology Macromedia Dreamweaver MS Visual Studio Database connectivity via desktop DBMS such as MS Access Database connectivity via programming languages such as MS Visual Basic Database-Introduction-1 Area of Interest

  6. Department File-Servers User Workstation User Workstation Corporate Servers Operator Workstation Client/Server Architecture • 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 Database-Introduction-1

  7. 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) Database-Introduction-1

  8. 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. • 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). Database-Introduction-1

  9. 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. Database-Introduction-1

  10. 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) Database-Introduction-1

  11. 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. Database-Introduction-1

  12. Data Model • 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)? Database-Introduction-1

  13. Data Model • 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 • EntityRelationship 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 Database-Introduction-1

  14. Normalisation (NF) • 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 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 Database-Introduction-1

  15. PHYSICAL VIEW • 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 LOGICAL VIEW • FORMS • INFORMATION • External Schema View • Form or Screen views provided to the end user. • A set of FORMSderived from the TABLES • Logical View – for Users Database-Introduction-1

  16. 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. Database-Introduction-1

  17. 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. Database-Introduction-1

  18. Inventory Customer Service Finance Production H R External Schemas and Views Conceptual External Internal Database-Introduction-1

  19. 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. Database-Introduction-1

  20. 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. Database-Introduction-1

  21. 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. Database-Introduction-1

  22. 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. Database-Introduction-1

  23. 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 Hierarchical model Network model Relational model Database-Introduction-1

  24. Supplier Name Link File Supplier Part No: Database Types - Network Can show all 1:n relationships between records Part No: Database-Introduction-1

  25. Electrical Steel Oils Fasteners Part No: Quantity Supplier Name Location Supplier Code Supplier Part No: Database Types - Hierarchical STOCK Database-Introduction-1

  26. STOCK ITEM STOCK ITEM STOCK ITEM STOCK ITEM 12345 12345 Part No: 7 N/A Quantity Colour 4 98 Reorder Qty Weight Ferris F37 Supplier Name Location F2 Supplier Code c801 Description PRIMARYKEY Supplier Part No: Cadmium Bar 90mm dia Database Types - Relational Data Files FILE RECORD FIELD(S) FIELD VALUES KEY FIELD Database-Introduction-1

  27. STOCK ITEM STOCK ITEM STOCK ITEM LOGICAL 12345 12345 Part No: 7 FIELD(S) N/A Quantity Colour 4 98 Reorder Qty FIELD VALUES Weight Ferris F37 Supplier Name Location F2 Supplier Code PHYSICAL c801 Description Supplier Part No: Cadmium Bar 90mm dia Database Types - Relational Logical vs. Physical Database-Introduction-1

  28. STOCK ITEM STOCK ITEM STOCK ITEM 12345 12345 7 N/A 4 98 Ferris F37 F2 c801 Cadmium Bar 90mm dia Relationships - 1:1 Part No: Quantity Colour Reorder Qty Weight Supplier Name Location Supplier Code Description Supplier Part No: Database-Introduction-1

  29. STOCK ITEM STOCK ITEM STOCK ITEM 12345 7 N/A 4 98 Ferris F37 F2 c801 Cadmium Bar 90mm dia Relationships - 1:n Part No: 12345 Quantity Colour Reorder Qty Weight Supplier Name Location Supplier Code Description Supplier Part No: Database-Introduction-1

  30. STOCK ITEM STOCK ITEM STOCK ITEM 12345 7 N/A 4 98 Ferris F37 F2 c801 Cadmium Bar 90mm dia Relationships - m:n Part No: 12345 Quantity Colour Reorder Qty Weight Supplier Name Location Supplier Code Description Supplier Part No: Database-Introduction-1

  31. Relational Model TechniqueFuture Lectures will cover the Entity Relationship Diagrams (ERD’s) Database-Introduction-1

More Related