digital media technology week 12. □ remaining sql theory □ mysql □ data visualisation...
DESCRIPTION
□ Database Design □ Data Retrieval □ Implementation □ Data Entry □ Data VisualisationTRANSCRIPT
Digital Media Technology
Week 12
□ Remaining SQL theory
□ MySQL
□ Data visualisation
Today’s lecture
□ Database Design
□ Data Retrieval
□ Implementation□ Data Entry
□ Data Visualisation
□ Relation model developed by E.F. Codd in 1970□ SEQUEL implemented by Chamberlin and Boyce in 1974; Design driven by “the need for linear
notation, and the need for readable programs that are easy to maintain and modify”. □ First SQL-based RDBS, Oracle, launched in 1979□ ANSI-standard in 1986 and ISO-standard in 1987
SQL
Open standards□ Adopted and maintained by an authorised standisation organization□ Documentation is fully available□ No constraints on the use or the re-use of the standard (interoperability)
Proprietary standards□ Risk of “vendor-lock in”□ Migration and system integration is often complicated
Open vs. Proprietary Standards
The year of the oldest treasure in the database
SELECT MIN(YEAR)FROM TREASURE ;
1560
Query:
Result:
The number of countries in the table CREATOR
SELECT COUNT( DISTINCT COUNTRY_BORN )FROM CREATOR ;
8
Query:
Result:
The number of persons for each country in the table CREATOR
AT
BE
DE
FR
GB
IE
IE
IT
IT
NL
11111
2
2
1
SELECT COUNTRY_BORN , COUNT(*)
FROM CREATOR
GROUP BY COUNTRY_BORN ;
Query:
Libraries that are represented by two or more treasures.
SELECT LIBRARY , COUNT(*) FROM TREASURE GROUP BY LIBRARY HAVING COUNT(*) >= 2 ;
6 2
Query:
Result:
Joining tables
□ After “FROM”: Mention the two tables that you want to join□ After “WHERE”: Explain HOW the tables are related (PK = FK)
□ INNER JOIN May result in a loss of information
Subjects that have been assigned to two or more treasures in the database
SELECT S.SUBJECT , COUNT(*)FROM TREASURE T, SUBJECT SWHERE T.SUBJECT = S.CODE GROUP BY S.SUBJECT HAVING COUNT(*) > 1
Query:
Result:
Art and architecture 4History 3
□ MySQL: open source RDBMS
□ Extensive documentation on MySQL website
□ Databases are built using SQL queries
□ MySQL may be used via command prompt;
□ Database can also be accessed, for instance, via PHP (PHPmyAdmin)
<html> <head> <title></title> </head> <body> <?php $time = date("h") ; if ( $time < 12 ) { print "Good morning!" ; } elsif ( $time < 18) { print "Good afternoon!" ; } else { print "Good evening!" ; } ?> </body></html>
HTMLPHP
http
SERVER
CLIENT
HTML
HTMLPHP
http
MySQL
SERVER
CLIENT
HTMLdb
Public interface
Visualisation code libraries
□ D3.js
□ Google charts
Visualisation of BTCP data
□ Line charts
□ Bar charts
□ Georeferencing
BTCP Database