2. Business PHP lessons today and tomorrow 2 today, 4 tomorrow – can on move? To meet in room 323
3. Review Data structures Have addressable elements Have Categories, Instances, and Values Data models Categories are implicitly related to each other Organized around an implicit subject Each instance (e.g. a row in table) is an example of the subject
5. Example What is the implicit subject? CATEGORIES EACH ROW IS AN INSTANCE, EACH CELL CONTAINS VALUES
6. IMPLIED SUBJECT COUNTRY (owns) (uses) SOCIAL NETWORK US Debt Country X uses social network Y Country X owns US Debt Z (in billions of $)
7. Overview When last we met We created a MySQL account on UVA’s server We created a database for our account We logged into phpMyAdmin to see our new database Today we will learn how to Upload CSV data to MySQL Search and query this data Create new tables of data from scratch Learn some basic SQL commands to interact with the data
8. Exercise Go to database on phpMyAdmin https://dbm2.itc.virginia.edu/phpmyadmin Download the two CSV files Import into your database Explore See: http://pages.shanti.virginia.edu/Dataesthetics_S11/archives/187
9. Exercise: Modify Table Familiarize yourself with the interface Left and Right sides On the Right: Top and Bottom Go to Operations view to change table name Go to Structure view to modify columns Click on icon next to table name Or click on Structure tab when looking at table Review data types
10. Data Types See http://pages.shanti.virginia.edu/Dataesthetics_S11/?p=194&preview=true
11. Exercise: Searches Use the Search function to: Find all countries that use Facebook Find China in both tables Find countries that own a debt larger than 50
12. Exercise: Queries Use the SQL function to make calls with the following SQL keywords SELECT FROM WHERE ORDER BY DISTINCT Syntax Table names and columns can be quoted with “back ticks” Strings quotes with single quotes