Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database elements. SWC - 2011 2 Database elements A database can be compared to an old- fashioned file cabinet –The entire cabinet is the database –A.

Similar presentations


Presentation on theme: "Database elements. SWC - 2011 2 Database elements A database can be compared to an old- fashioned file cabinet –The entire cabinet is the database –A."— Presentation transcript:

1 Database elements

2 SWC Database elements A database can be compared to an old- fashioned file cabinet –The entire cabinet is the database –A drawer is a table –A folder is a record –One piece of information is a field

3 SWC Table A table contains data about one specific type of entity, and always on the same form Person NameAddressPhoneBornMarried Per JensenSkolevej No Jane HøstAllégade Yes Allan RavnSvinget Yes Ole OlsenJunivej Yes Ditte DorfmannDalstrøget No

4 SWC Table A table should have a proper name, reflecting the type of entity stored in the table Some tables are directly related to entities, others are related to relations between entities A table definition consists of definitions of data fields, each with a name and type

5 SWC Record A record is a single row in a specific table, containing information about a single entity Person NameAddressPhoneBornMarried Per JensenSkolevej No Jane HøstAllégade Yes Allan RavnSvinget Yes Ole OlsenJunivej Yes Ditte DorfmannDalstrøget No

6 SWC Record All records in a specific table always has the same form All records in a specific table must be unique (have a key field) A key field consists of one or more fields in the table definition, the combination of which is always unique

7 SWC Record What makes a Person unique…? Person NameAddressPhoneBornMarried Per JensenSkolevej No Jane HøstAllégade Yes Allan RavnSvinget Yes Ole OlsenJunivej Yes Ditte DorfmannDalstrøget No

8 SWC Field A field is a single piece of information, about one specific entity in the table Person NameAddressPhoneBornMarried Per JensenSkolevej No Jane HøstAllégade Yes Allan RavnSvinget Yes Ole OlsenJunivej Yes Ditte DorfmannDalstrøget No

9 SWC Field A field has a name and a type The type of the field should reflect the possible content of the field –String (text data) –Number (numeric data) –Date (dates, time) –Yes/No (binary choices) –Binary (picture, attached file,…)

10 SWC Designing a database Designing a database looks fairly easy… Designing it correctly can be more challenging! Correctly: Avoid the two arch enemies of databases –Redundancy –Inconsistency

11 SWC Designing a database Redundancy: the phenomenon that the same data occurs multiple times in the database –Makes the database unnecessarily large –Data processing becomes slower –Increases the risk of inconsistency

12 SWC Designing a database NameAddressPhoneBornCourse Per JensenSkolevej English Per JensenSkolevej IT Ditte DorfmannDalstrøget English Ditte DorfmannDalstrøget Economics Ditte DorfmannDalstrøget Math Student

13 SWC Designing a database IdNameAddressPhoneBorn 1Per JensenSkolevej Ditte DorfmannDalstrøget Student Enrollment IdCourse 1 English 1 IT 2 English 2 Economics 2 Math

14 SWC Designing a database Inconsistency: the phenomenon, that some data is in conflict with each other. Not all data can be correct Which data should we trust then? If the database is free of redundancy, simple inconsistency cannot occur

15 SWC Designing a database NameAddressPhoneBornCourse Per JensenSkolevej English Per JensenSkolevej IT Ditte DorfmannDalstrøget English Ditte DorfmannDalstrøget Economics Ditte DorfmannBakkehøj Math Student


Download ppt "Database elements. SWC - 2011 2 Database elements A database can be compared to an old- fashioned file cabinet –The entire cabinet is the database –A."

Similar presentations


Ads by Google