1 / 32

Database Design Concepts IMAT1408

Database Design Concepts IMAT1408. Lecture 2 Database Fundamentals. Database Design Concepts IMAT1408. Lecture 2 Database Fundamentals. To introduce: The three layers of data abstraction (ways of viewing/handling data) The terms physical and logical data independence

avian
Download Presentation

Database Design Concepts IMAT1408

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. Database Design ConceptsIMAT1408 Lecture 2 Database Fundamentals

  2. Database Design Concepts IMAT1408 Lecture 2 Database Fundamentals

  3. To introduce: The three layers of data abstraction (ways of viewing/handling data) The terms physical and logical data independence Table types and associated terms. Objectives

  4. Is this a database? Is this Organised? Efficient? Easily accessible? Flexible? ……

  5. Paper based databases • Have been around for a long time • Data is organised and quickly accessible • So is easier to maintain – fewer errors • But is not all that flexible – things are filed in one place only (why would it not be a good idea to have duplicates?).

  6. Are managed by a Computer based databases Database Management System (DBMS) Moves data to and from physical data files Manages multiple users Manages transactions: ‘all or nothing’ units of work Supports a Query Language to retrieve data from the database Manages back ups Provides security mechanisms.

  7. Typical Example of a Database Internet Architecture Internet Explorer Browser INTERNET Firefox Browser APACHE WEB-SERVER communicates with the web users PHP or ASP.NET ODBC/API communicates with DB MAPPING Logical Shema (Relational Tables) MySQL DATABASE Database Server

  8. Databases are obviously very complicated pieces of software How do we understand how they work? They are divided into 3 layers – known as the 3 layer architecture We can look at each layer in turn…… Layers of data abstraction

  9. External layer What the user sees How the database organises the data for viewing Logical layer How the computer’s operating system stores the data Physical layer

  10. The DBMS enables multi-user access to the same data at the same time EXTERNAL layer Userview 2 Userview 1 LOGICAL layer MAPPING Logical Schema MAPPING INTERNAL layer INDEXES DATA

  11. External layer User View 2 User View 1 User View …. Logical Data independence Logical layer Conceptual Schema Physical Data independence Physical layer Database File Database File Database File Database File Database File

  12. The files that actually contain the data Data could be stored over multiple disk drives –maximiseperformance by running in parallel Microsoft Access stores everything in one physical file. This limits the number of concurrent users and so it cannot be used for large enterprises The DBMS works with the computer’s Operating System (OS) to efficientlymanage the file storage The user of the database does not need to know how the DBMS does this. The Physical Layer

  13. External layer User View 2 User View 1 User View …. Logical layer Logical Data independence Conceptual Schema Physical Data independence Physical layer Database File Database File Database File Database File Database File

  14. The logical layer provides a structurefor the data which is known as the conceptual schema This structure needs to meet the requirements of the users. This is what we will work on when we design databases. It makes the data available to any application (or several at once) without the designer needing to know the exact location of the data – the data is therefore independent of the applications. For example a customer database record could be used in many different applications - for billing invoices, posting out publicity flyers about new products, sending on-line questionnaires etc.,etc.. Logical Layer

  15. External layer User View 2 User View 1 User View …. Logical Data independence Logical layer Conceptual Schema Physical Data independence Physical layer Database File Database File Database File Database File Database File

  16. This is the layer where users interact with the database and issue queries The DBMS selects items from the logical layer to form a user view Different user views can be set up to meet different people’s needs These user views can be stored for future use, or may be used only temporarily and then discarded – an ad hoc query. External Layer

  17. We need to look at each user’s requirements These give us the external views required You will learn to create the conceptual schema so that these external views can be produced from it. One method we will use is Entity Relationship Modelling We will leave the DBMS to take care of the physical layer. The 3 layers and database design

  18. External layer User View 2 User View 1 User View …. Logical Data independence Logical layer Conceptual Schema Physical Data independence Physical layer Database File Database File Database File Database File Database File

  19. Physical data independence means you can change the way the data is stored without having to change all the programs that use the data. This saves time and money. Data Independence- the big advantage of databases

  20. External layer User View 2 User View 1 User View …. Logical Data independence Logical layer Conceptual Schema Physical Data independence Physical layer Database File Database File Database File Database File Database File

  21. The ability to make changes to the logical layer without disrupting existing users and processes This means we can: Add a new database object eg a table Add data items to an existing object. Logical Data Independence

  22. To create a useful database we must study the business’s activities and identify the data that needs to be stored We look for entities Just about anything that can be named can be an entity …but we only consider things of interest to the users of our database. Design components: Entity

  23. A very common entity that is found in many business oriented databases is the This represents all the customers in the database ……… an individual customer is known as an occurrenceof the entity. CUSTOMER

  24. “An attribute is a unit fact that characterises or describes an entity in some way” (Oppel, 2004) Attributes are the smallest units of information that are stored in a database Examples could be the customer’s last name, post code, telephone number. Attributes

  25. An entity will be described using the attributes. For example a student could have last name, first name and several address attributes The problem is we need to distinguish one student from another Most students can be identified by their name but sometimes two students have the same name How do I make sure I don’t award marks to the wrong student? Unique identifiers

  26. I do this by using an attribute known as the primary key This is a unique identifier so each student will have a different value for this attribute What is your unique identifier? Remember these unique identifiers are often invented so are not always known to the person concerned.

  27. National insurance number Passport number Membership number Order number Vehicle registration number Bank account number. Examples of unique identifiers^

  28. Main method of storage in the relational model is the table A two dimensional structure composed of rows and columns Each row represents one occurrence (instance) of the entity (or record) Each column represents one attribute of that entity. Tables

  29. We show a table’s structure by showing its table type Eg Student (studentno, name, address, courseno) Each Student record will have the same structure but different values. Table Types Table Name Primary Key Attributes Foreign Key

  30. The foreign key is the primary key of another table It creates a link between the two tables courseno in our example will be the key field of a course table Course (courseno, title) This allows us to look up the title of the course each student is taking. Foreign Key

  31. You should be able to explain: Database Management System Physical, logical and external layers (and draw a diagram of them) Physical and logical data independence Entity (more on this next week) Attribute Primary key/unique identifier Table type Foreign key. Summary

  32. Databases Demystified by Andy Oppel (Published by McGraw-Hill, ISBN 0-07-225364-9) Data Analysis for Database Design by David Howe (Published by Arnold. Second edition.) References

More Related