Presentation is loading. Please wait.

Presentation is loading. Please wait.

FatMax 2007. Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 LicenseCreative Commons Attribution-NonCommercial-ShareAlike 2.5.

Similar presentations


Presentation on theme: "FatMax 2007. Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 LicenseCreative Commons Attribution-NonCommercial-ShareAlike 2.5."— Presentation transcript:

1 FatMax 2007. Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 LicenseCreative Commons Attribution-NonCommercial-ShareAlike 2.5 License RDBMS (An Introduction)

2 FatMax 2007. Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 LicenseCreative Commons Attribution-NonCommercial-ShareAlike 2.5 License Why Relational Databases? Data is stored in a database so that it can be sorted and searched to provide meaningful information What are the advantages of RDBMS over flat file systems?

3 FatMax 2007. Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 LicenseCreative Commons Attribution-NonCommercial-ShareAlike 2.5 License Flat File Problems Recall the main problems of flat file databases Redundancy Inconsistency Difficult to update Program/data dependence The aim of using a RDBMS is to eliminate (as far as possible) these problems

4 FatMax 2007. Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 LicenseCreative Commons Attribution-NonCommercial-ShareAlike 2.5 License RDBMS - Entities A relational database consists of multiple tables joined (linked) together by relationships Each table should contain data about a single entity Person – Employee Object - Book Event - Project

5 FatMax 2007. Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 LicenseCreative Commons Attribution-NonCommercial-ShareAlike 2.5 License Relationships Usually joined on primary/foreign key Relationship have a degree (i.e. there are different types): Entities (tables) are joined together by relationships

6 FatMax 2007. Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 LicenseCreative Commons Attribution-NonCommercial-ShareAlike 2.5 License Relation Types 3 degrees (types) of relationship One-to-Many Many-to-Many One-to-One Doctor/Patient Teacher/Form Group Students/Classes

7 FatMax 2007. Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 LicenseCreative Commons Attribution-NonCommercial-ShareAlike 2.5 License Drawing Relationships Entity-Relationship Diagram Shows the type of and nature of relationship between entities in the system ArtistAlbums

8 FatMax 2007. Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 LicenseCreative Commons Attribution-NonCommercial-ShareAlike 2.5 License Worked Example 1 Look at the iTunes database on the next slide Draw an E-RD of the entities you would expect to see if this was converted into a relational database HINT: There are 4 entities. All relationships are one-to-many

9 FatMax 2007. Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 LicenseCreative Commons Attribution-NonCommercial-ShareAlike 2.5 License Worked Example 2

10 FatMax 2007. Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 LicenseCreative Commons Attribution-NonCommercial-ShareAlike 2.5 License Worked Example 3 Did you get something like this? AlbumsArtistsTracks Genres

11 FatMax 2007. Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 LicenseCreative Commons Attribution-NonCommercial-ShareAlike 2.5 License RDBMS - Attributes Attributes describe the properties of an entity It’s easiest to think of attributes as fields

12 FatMax 2007. Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 LicenseCreative Commons Attribution-NonCommercial-ShareAlike 2.5 License Database Notation When documenting databases (e.g. for coursework) use standard database notation The name of the table (Entity) appears in upper case The fields (attributes) are shown in brackets The key field is underlined COURSE_VENUE (Venue_ID, Venue_Name, Address, Town, County, Telephone, Postcode)

13 FatMax 2007. Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 LicenseCreative Commons Attribution-NonCommercial-ShareAlike 2.5 License Database Architecture WYSINWYG What you see is NOT what you get!!! The DBMS is an application program that provides an interface between the data and the user in order to make access to the data stored as simple as possible. The user interface is not necessarily a true reflection of how data is stored!

14 FatMax 2007. Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 LicenseCreative Commons Attribution-NonCommercial-ShareAlike 2.5 License Three Level Architecture EXTERNAL / USER SCHEMA INTERNAL / STORAGE SCHEMA CONCEPTUAL / LOGICAL SCHEMA Schema are ‘views’ – they describe the structure and how a database can be accessed. There are three main schema, which allow DBMS administrators to look at the structure and design of a database in different ways. The DBMS is an application program that provides an interface between the data and the user in order to make access to the data stored as simple as possible.

15 FatMax 2007. Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 LicenseCreative Commons Attribution-NonCommercial-ShareAlike 2.5 License Three Level Architecture 2 EXTERNAL / USER INTERNAL / STORAGE CONCEPTUAL / LOGICAL This is the overall view of the entire database, including entities, attributes and relationships as designed by the database administrator. How the data will be stored and is concerned with file organisation and access methods. This is the individual’s view of the database – in multi-user databases, there will be several different external schema giving different people different access rights.

16 FatMax 2007. Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 LicenseCreative Commons Attribution-NonCommercial-ShareAlike 2.5 License Internal Storage In the internal/storage schema data about each entity is stored only once in its entirety Therefore: Less duplication (redundancy) No inconsistencies across duplicates (because there aren’t any duplicates!!!!) Less disk space required Easier to update

17 FatMax 2007. Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 LicenseCreative Commons Attribution-NonCommercial-ShareAlike 2.5 License Research/Tasks Make notes from your textbook/web sources about the benefits of RDBMS over flat files Complete the revision diagram at http://fatmax.info/moodle/mod/resource/view.php?id=31 Disclaimer: The slides on database architecture come directly from a presentation by R. Cawley and are © R. Cawley. If you choose to alter this presentation you MUST leave this copyright notice intact.


Download ppt "FatMax 2007. Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 LicenseCreative Commons Attribution-NonCommercial-ShareAlike 2.5."

Similar presentations


Ads by Google