Presentation is loading. Please wait.

Presentation is loading. Please wait.

Essential Databases The simple truth!. What’s a database? A system which helps with –storage –retrieval in an efficient manner –assume large volumes of.

Similar presentations


Presentation on theme: "Essential Databases The simple truth!. What’s a database? A system which helps with –storage –retrieval in an efficient manner –assume large volumes of."— Presentation transcript:

1 Essential Databases The simple truth!

2 What’s a database? A system which helps with –storage –retrieval in an efficient manner –assume large volumes of data paradigm - relational –(will also cover OODB)

3 The Data Model model –an artificially constructed device which approximates to a part of tha real world good model –properties of the model correspond to properties of the real world for all models –not always the case

4 In a database… the model is used to give –understanding to users/programmers tools to populate the database –tools to check queries make sense soundness –optimisation for queries increasingly less important for many databases

5 Creating a database phase 1 –design the schema nothing else can happen until this is fixed it can never be subsequently changed!! phase 2 –define queries, views etc. phase 3 –hand over to users to populate and use database leave without forwarding address!

6 The entity/relationship approach decide which real-world entities to model –eg people, cars, buildings etc. decide what attributes each entity has –eg age, name, address etc. decide what relationships exist among entities –eg owns, lives_at, employee_of etc sounds easy?

7 Entity-relationship diagrams just pictures capturing the above in some kind of coded form –lots of different notations exist… usual communication medium amongst designers, between designers and programmers etc. some systems allow them as basic input –play with MS Access

8 The Relational Model everything is coded as a relation –entities and relationships think of them as tables… –with care: no duplicates, no update the model doesn’t quite match the real world –it’s easy and dangerous to forget that

9 Modeling entities... straightforward for regular data think of: –relation as a table –entities as rows remember no repeats! –attributes as columns with basic scalar types eg int, string, date etc.

10 … and relationships how to capture an arbitrary relationship in a relation? relationships are between entities (rows) in other tables first n columns can uniquely identify entity in one relation, next m columns can uniquely identify entity in another relation. –(notice underlying strong theories)

11 (Relational) Keys a key is a subset of a relation’s attributes, the values of which uniquely identify every attribute –they can change according to the values present a primary key is that chosen by a DB designer for this purpose a foreign key is one that coexists in another relation

12 Modeling relationships again… we now know we can model any relationship –a new relation containing foreign keys for the two original relations each row in such a relation gives a two-way link –between rows in the two original relations can model any kind of relationship –one-one, one-many, many-one, many-many


Download ppt "Essential Databases The simple truth!. What’s a database? A system which helps with –storage –retrieval in an efficient manner –assume large volumes of."

Similar presentations


Ads by Google