2. Business If you are still having problems with VPN, call the Help Desk Anyone interested in an extra session on PHP? Thursday (2/24) from 1:30 to 3:30
3. Review PHP as a language Meanings Nouns and Verbs Grammatical words (prepositions, conjunctions) Clauses and sentences Stories How to import a file and transform it using conditional logic See 02-17/rex.php
4. Overview This week we view another language devoted to working with data Data are like “meanings” Data are what values are made of Works in tandem with PHP Lives at the “bottom” of the stack The foundation …
5. The Stack CSS HTML JavaScript INTERACTION HTML (DOM) PHP Local files Remote files ALGORITHM SQL DATA
7. Basic Data Structures Tables CSV Excel Arrays PHP JavaScript Trees XML and the “Document Object Model”(DOM) Implied by CSS selectors, e.g. .part p {} Arrays of arrays, e.g. $foo[0] = array(); $foo[5][2] = “bar”;
9. Data Structures All have addressableelements Elements with unique names Row C, Column A DIV.section[1]/DIV.part[2]/P[5] Alll have an implicit template of categories CSV has a header of column names XML has element types and classes Arrays have indexes All consist of repeated instances of the template E.g. rows
12. Implicit Data Models All data structures have a data model May be implicit More or less coherent May not be “true” A data model is a schematic representation of how the categories in the template are related to each other
13. COUNTRY owns uses SOCIAL NETWORK US Debt Country X uses social network Y Country X owns US Debt Z (in billions of $)
14. SQL SQL stands for “Structured Query Language” Pronounced S-Q-L or as “sequel” NOT invented by Microsoft Invented in the 1970s and commercialized in the 1980s Probably responsible for new business models Built on Codd’s relational model (1970) Implements set theory Around the time of SGML
15. SQL A language used by relational databases Oracle, SQL Server, Access, etc.
16. MySQL A very fast, simplified, and easy to use relational database A client/server app Runs on the internet Not a desktop app like Access Created by Monty Widenius in the mid 1990s Open Source A Finn living in Sweden Same time as PHP Powered the Web 2.0 revolution
17. phpMyAdmin A PHP interface to MySQL Relatively easy to use No need to know SQL Great to manage databases that your PHP programs will use Today you will get started using UVA’s free MySQL server
18. Exercise Create a MySQL account Create a database called MDST2559 Go to phpMyAdmin Import the file into a table called ‘demo’
19. Some SQL Commands From the SQL box, enter SELECT * FROM demo SELECT country, network FROM demo SELECT DISTINCT network FROM demo SELECT country, debt FROM demo WHERE network = ‘Facebook’ SELECT country, debt FROM demo ORDER BY ‘debt’ DESC