1 / 22

Digital Media Technology

Digital Media Technology. Week 11. Implementation. Data entry. Database Design. Retrieval. Similarities betweeen techniques and concepts. XPath - SQL DTD/Schema - ERD. Booktrade Database. Indexes to transcriptions from the Bohn archive

starr
Télécharger la présentation

Digital Media Technology

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Digital Media Technology Week 11

  2. Implementation • Data entry • Database Design • Retrieval

  3. Similarities betweeen techniques and concepts • XPath - SQL • DTD/Schema - ERD

  4. Booktrade Database • Indexes to transcriptions from the Bohn archive • Relations between letters, persons, companies, titles

  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. INSERT INTO CREATOR VALUES ('1','Baudelaire','Charles','1821','1867','FR'), ('2','Mozart','Wolfgang Amadeus','1756','1791','AT'), ('3','Bruegel The Elder','Pieter','1525','1569','BE'), ('4','Sadler','William','1782','1839','IE'), ('5','Tiemann','Walter','1876','1951','DE'), ('6','Macchiavelli','Giacomo','1756','1811','IT'), ('7','Galilei','Galileo','1564','1642','IT'), ('8','Parker','Matthew','1504','1575','GB'), ('9','Wittel','Caspar van','1655','1736','NL'), ('10','Molyneux','Daniel','1568','1632','IE') ; UPDATE CREATOR SET NAME_LAST='Charles Pierre' WHERE PID= 1 ;

  7. DELETE DATABASE TREASURE ; DROP TABLE CREATOR ;

  8. SELECT TITLE, YEAR FROM TREASURE ;

  9. SELECT * FROM TREASURE ;

  10. SELECT TITLE, YEARFROM TREASUREORDER BY YEAR ;

  11. SELECT TITLE, YEAR FROM TREASURE WHERE YEAR > 1800 ;

  12. SELECT DISTINCT SUBJECT FROM TREASURE ;

  13. SQL Functions • COUNT ( ) ; • SUM ( ) ; • AVG ( ) ; • MIN ( ) ; • MAX ( ) ;

  14. SELECT COUNT(*) FROM TREASURE ;

  15. Query1 Query1 SELECT COUNTRY_BORN, COUNT(*) FROM CREATOR GROUP BY COUNTRY_BORN ;

  16. Query1 Query1 1 1 1 1 1 1 1 1 2 2 1

  17. COUNTRY_BORN ie 2 it 2 SELECT COUNTRY_BORN, COUNT(*) FROM CREATOR GROUP BY COUNTRY_BORN HAVING COUNT(*) >= 2 ;

  18. Joining tables SELECT NAME_FIRST, NAME_FIRST, TITLE FROM TREASURE, CREATOR WHERE CREATOR = CREATOR_ID ;

  19. PHP HTML http HTML db SQL CLIENT SERVER

  20. A structured approach to writing queries • Which table(s) contains the information that you need? • Are you interested in all the records in this/these table(s)? • Are you interested in the actual contents of the records or in statistical information about the records in the table? If so, would you like to receive one answer for the entire table, or would you like to receive different answers for different types of records? • Which columns do you want to see? • Do you want to see duplicate values or are you only interested in different values? • Do the records in the result set need to be sorted in any particular way?

More Related