Presentation is loading. Please wait.

Presentation is loading. Please wait.

Digital Media Technology Week 7. □ Database □ DBMS □ Data vs. Information □ Data redundancy □ Tables, Rows, Columns, Records, Fields □ Relational data.

Similar presentations


Presentation on theme: "Digital Media Technology Week 7. □ Database □ DBMS □ Data vs. Information □ Data redundancy □ Tables, Rows, Columns, Records, Fields □ Relational data."— Presentation transcript:

1 Digital Media Technology Week 7

2 □ Database □ DBMS □ Data vs. Information □ Data redundancy □ Tables, Rows, Columns, Records, Fields □ Relational data model □ RDBMS

3 foreign key primary key TREASURE_IDTITLECREATORLIBRARYSUBJECTYEAR 1Sidereus Nuncius77SCI1610 2Requiem KV 62621MUS1791 3Rabbit Hunt, in the lower left Brueghel ART1560 4De antiquitate Britanicae Ecclesiae84ART1572 5Vedute di Roma con scene di costume66HIS1810 6Corrected page proofs of 'Les Fleurs du mal'12HIS1857 7Vinegar Hill, charge of the 5th Dragoon Guards45HIS1880 8Poster of "Internationale Ausstellung für Buchgewerbe und Graphik"59ART1914 9Fontana dei Fiumi a Piazza Navona96ART1734 CREATOR _ID NAME_LASTNAME_FIRSTYEAR_OF_BIRTHYEAR_OF_DEATHCOUNTRY_BORN 1BaudelaireCharles FR 2MozartWolfgang Amadeus AT 3Bruegel The ElderPieter BE 4SadlerWilliam IE 5TiemannWalter DE 6MacchiavelliGiacomo IT 7GalileiGalileo IT 8ParkerMatthew GB 9WittelCaspar van NL 10MolyneuxDaniel IE

4 FK = PK

5 CREATE TABLE TREASURE ( TREASURE_ID INT (4) NOT NULL AUTO_INCREMENT, TITLE VARCHAR (150), CREATOR INT, LIBRARY CHAR(6), SUBJECT CHAR(3), YEAR INT (4), PRIMARY KEY (TREASURE_ID), FOREIGN KEY (CREATOR) REFERENCES CREATOR ON DELETE RESTRICT ON UPDATE CASCADE, FOREIGN KEY (LIBRARY) REFERENCES LIBRARY ON DELETE RESTRICT ON UPDATE CASCADE, FOREIGN KEY (SUBJECT) REFERENCES SUBJECT ON DELETE RESTRICT ON UPDATE CASCADE );

6 Entity Relationship Diagrams

7 PERSON P_ID NAME PHONE DATE_OF_BIRTH Attributes PK is underlined

8 BOOK PERSON COMPANY

9 □ Cardinality of many is represented by a line ending in a crow's foot.

10 PERSON COMPANY many EMPLOYMENT P_IDC_ID P_ID C_ID E_ID many one many one

11 Making an ERD □ Identify entities □ Consider the cardinality of the relations between these entities □ One-to-one relations must be removed – these entitites can be combined in a single entity □ Change many-to-many relations into one- to-many relations by making use of linking tables □ Add attributes

12 General principle: avoid fields which contain values which can be derived from other fields. PRICENo. ITEMS ORDERED TOTAL PRICE € 205 € 100 PLACEPOPULATIONLAND AREADENSITY New York city7,322, ,705

13 codename ukGreat Britain frFrance neThe Netherlands beBelgium A look-up table (based on ISO )

14 NameCountry_born Shelley, Percy ByssheGreat Britain Swinburne, Algernon Charles Britain Cowper, WilliamUnited Kingdom Coleridge, Samuel TaylorU.K.

15 NameCountry_born Shelley, Percy Byssheuk Swinburne, Algernon Charles uk Cowper, Williamuk Coleridge, Samuel Tayloruk

16 Referential Integrity □ Each foreign key should correspond to an existing primary key. □ Most DBMSs take measures to prevents users or applications from entering inconsistent data.

17 CREATE TABLE BOOK ( B_ID INT NOT NULL AUTO_INCREMENT, TITLE VARCHAR (50), AUTHOR INT, LANGUAGE VARCHAR (40), PUBLISHER INT, EXTENT INT, YEAR INT(4), PRIMARY KEY (B_ID), FOREIGN KEY (AUTHOR) REFERENCES PERSON ON DELETE RESTRICT ON UPDATE CASCADE, FOREIGN KEY (PUBLISHER) REFERENCES COMPANY ON DELETE RESTRICT ON UPDATE CASCADE );

18 □ Implementation □ Data entry □ Database Design

19

20 HTML http SQL SERVER CLIENT HTML db

21 □ SQL: Structured Query Language □ Supported by most RDBMSs. □ Makes use of regular English words

22 Interpretation continuum Data: relatively unstructured Information: very structured Source: Obrst and Liu, Knowledge representation, Ontological Engineering and Topic Maps, in: XML Topic Maps, 2003

23 foreign key primary key TREASURE_IDTITLECREATORLIBRARYSUBJECTYEAR 1Sidereus Nuncius77SCI1610 2Requiem KV 62621MUS1791 3Rabbit Hunt, in the lower left Brueghel ART1560 4De antiquitate Britanicae Ecclesiae84ART1572 5Vedute di Roma con scene di costume66HIS1810 6Corrected page proofs of 'Les Fleurs du mal'12HIS1857 7Vinegar Hill, charge of the 5th Dragoon Guards45HIS1880 8Poster of "Internationale Ausstellung für Buchgewerbe und Graphik"59ART1914 9Fontana dei Fiumi a Piazza Navona96ART1734 CREATOR _ID NAME_LASTNAME_FIRSTYEAR_OF_BIRTHYEAR_OF_DEATHCOUNTRY_BORN 1BaudelaireCharles FR 2MozartWolfgang Amadeus AT 3Bruegel The ElderPieter BE 4SadlerWilliam IE 5TiemannWalter DE 6MacchiavelliGiacomo IT 7GalileiGalileo IT 8ParkerMatthew GB 9WittelCaspar van NL 10MolyneuxDaniel IE

24 SELECT TITLE, YEAR FROM TREASURE ; TITLEYEAR Sidereus Nuncius1610 Requiem KV Rabbit Hunt, in the lower left Brueghel De antiquitate Britanicae Ecclesiae1572 Vedute di Roma con scene di costume 1810 Corrected page proofs of 'Les Fleurs du mal' 1857 Vinegar Hill, charge of the 5th Dragoon Guards 1880 Poster of "Internationale Ausstellung für Buchgewerbe und Graphik" 1914 Fontana dei Fiumi a Piazza Navona1734

25 SELECT * FROM TREASURE ; treasure_idtitleyearcreatorlibrarysubject 1Sidereus Nuncius161077SCI 2Requiem KV MUS 3Rabbit Hunt, in the lower left Brueghel ART 4De antiquitate Britanicae Ecclesiae ART 5Vedute di Roma con scene di costume HIS 6Corrected page proofs of 'Les Fleurs du mal' HIS 7Vinegar Hill, charge of the 5th Dragoon Guards HIS 8Poster of "Internationale Ausstellung für Buchgewerbe und Graphik" ART 9Fontana dei Fiumi a Piazza Navona ART

26 SELECT TITLE, YEAR FROM TREASURE ORDER BY YEAR ; TITLEYEAR Rabbit Hunt, in the lower left Brueghel De antiquitate Britanicae Ecclesiae1572 Sidereus Nuncius1610 Fontana dei Fiumi a Piazza Navona1734 Requiem KV Vedute di Roma con scene di costume 1810 Corrected page proofs of 'Les Fleurs du mal' 1857 Vinegar Hill, charge of the 5th Dragoon Guards 1880 Poster of "Internationale Ausstellung für Buchgewerbe und Graphik" 1914

27 SELECT NAME_LAST, NAME_FIRST, (YEAR_OF_DEATH - YEAR_OF_BIRTH) AS AGE FROM CREATOR ; NAME_LASTNAME_FIRSTAGE BaudelaireCharles46 MozartWolfgang Amadeus 35 Bruegel The ElderPieter44 SadlerWilliam57 TiemannWalter75 MacchiavelliGiacomo55 GalileiGalileo78 ParkerMatthew71 WittelCaspar van81 MolyneuxDaniel64

28 SELECT TITLE, YEAR FROM TREASURE WHERE YEAR > 1800 ; TITLEYEAR Vedute di Roma con scene di costume 1810 Corrected page proofs of 'Les Fleurs du mal' 1857 Vinegar Hill, charge of the 5th Dragoon Guards 1880 Poster of "Internationale Ausstellung für Buchgewerbe und Graphik" 1914

29 SELECT DISTINCT SUBJECT FROM TREASURE ; SUBJECT ART HIS MUS SCI

30 Exercise 5

31 Exercise 6


Download ppt "Digital Media Technology Week 7. □ Database □ DBMS □ Data vs. Information □ Data redundancy □ Tables, Rows, Columns, Records, Fields □ Relational data."

Similar presentations


Ads by Google