Presentation is loading. Please wait.

Presentation is loading. Please wait.

Digital Media Technology Week 10. foreign key primary key TREASURE_IDTITLECREATORLIBRARYSUBJECTYEAR 1Sidereus Nuncius77SCI1610 2Requiem KV 62621MUS1791.

Similar presentations


Presentation on theme: "Digital Media Technology Week 10. foreign key primary key TREASURE_IDTITLECREATORLIBRARYSUBJECTYEAR 1Sidereus Nuncius77SCI1610 2Requiem KV 62621MUS1791."— Presentation transcript:

1 Digital Media Technology Week 10

2 foreign key primary key TREASURE_IDTITLECREATORLIBRARYSUBJECTYEAR 1Sidereus Nuncius77SCI1610 2Requiem KV 62621MUS1791 3Rabbit Hunt, in the lower left Brueghel 1560.33ART1560 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_IDNAME_LASTNAME_FIRSTYEAR_OF_BIRTHYEAR_OF_DEATHCOUNTRY_BORN 1BaudelaireCharles18211867FR 2MozartWolfgang Amadeus17561791AT 3Bruegel The ElderPieter15251569BE 4SadlerWilliam17821839IE 5TiemannWalter18761951DE 6MacchiavelliGiacomo17561811IT 7GalileiGalileo15641642IT 8ParkerMatthew15041575GB 9WittelCaspar van16551736NL 10MolyneuxDaniel15681632IE

3 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 );

4 FK = PK

5 Semantic Web

6 Entity Relationship Diagrams

7 PERSON P_ID NAME E-MAIL PHONE DATE_OF_BIRTH Attributes PK is underlined

8 BOOK PERSON COMPANY

9 □ Cardinality: how many instances of the entity can be associated with one instance of the related entity? BOOKCOMPANY

10 STUDENTCOURSE ENROLMENT

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

12 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

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

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 Interpretation continuum Data: relatively unstructured Information: very structured Source: Obrst and Liu, Knowledge representation, Ontological Engineering and Topic Maps, in: XML Topic Maps, 2003

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

20 SELECT TITLE, YEAR FROM TREASURE ; TITLEYEAR Sidereus Nuncius1610 Requiem KV 6261791 Rabbit Hunt, in the lower left Brueghel 1560. 1560 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

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

22 SELECT TITLE, YEAR FROM TREASURE ORDER BY YEAR ; TITLEYEAR Rabbit Hunt, in the lower left Brueghel 1560. 1560 De antiquitate Britanicae Ecclesiae1572 Sidereus Nuncius1610 Fontana dei Fiumi a Piazza Navona1734 Requiem KV 6261791 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

23 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

24 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

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

26

27


Download ppt "Digital Media Technology Week 10. foreign key primary key TREASURE_IDTITLECREATORLIBRARYSUBJECTYEAR 1Sidereus Nuncius77SCI1610 2Requiem KV 62621MUS1791."

Similar presentations


Ads by Google