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
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
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 …
What does data look like? How is it organized?
What do these structures have in common?
Data Structures All have addressableelements Elements with unique names Row C, Column A DIV.section/DIV.part/P 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
Categories, Instances, Values
Example What are the categories? Instances? Values?
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
COUNTRY owns uses SOCIAL NETWORK US Debt Country X uses social network Y Country X owns US Debt Z (in billions of $)
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
SQL A language used by relational databases Oracle, SQL Server, Access, etc.
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
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
Exercise Create a MySQL account Create a database called MDST2559 Go to phpMyAdmin Import the file into a table called ‘demo’
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