SlideShare a Scribd company logo
1 of 19
SQL 1 MDST 3559:  DataestheticsProf. Alvarado02/22/2011
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 …
The Stack CSS HTML JavaScript INTERACTION HTML (DOM) PHP Local files Remote files ALGORITHM SQL DATA
What does data look like? How is it organized?
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”;
What do these structures have in common?
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
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

More Related Content

What's hot

XML and Related Technologies - Web Technologies (1019888BNR)
XML and Related Technologies - Web Technologies (1019888BNR)XML and Related Technologies - Web Technologies (1019888BNR)
XML and Related Technologies - Web Technologies (1019888BNR)Beat Signer
 
HTML and XML Difference FAQs
HTML and XML Difference FAQsHTML and XML Difference FAQs
HTML and XML Difference FAQsUmar Ali
 
Document object model(dom)
Document object model(dom)Document object model(dom)
Document object model(dom)rahul kundu
 
XML-Extensible Markup Language
XML-Extensible Markup Language XML-Extensible Markup Language
XML-Extensible Markup Language Ann Joseph
 
Web data management (chapter-1)
Web data management (chapter-1)Web data management (chapter-1)
Web data management (chapter-1)Dhaval Asodariya
 
Web data management
Web data managementWeb data management
Web data managementAbdul Hannan
 
XML - EXtensible Markup Language
XML - EXtensible Markup LanguageXML - EXtensible Markup Language
XML - EXtensible Markup LanguageReem Alattas
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XMLKumar
 
Extensible Markup Language (XML)
Extensible Markup Language (XML)Extensible Markup Language (XML)
Extensible Markup Language (XML)AakankshaR
 
XML.ppt
XML.pptXML.ppt
XML.pptbutest
 
10. XML in DBMS
10. XML in DBMS10. XML in DBMS
10. XML in DBMSkoolkampus
 
EXtensible Markup Language
EXtensible Markup LanguageEXtensible Markup Language
EXtensible Markup LanguagePrabhat gangwar
 
An Introduction to the DOM
An Introduction to the DOMAn Introduction to the DOM
An Introduction to the DOMMindy McAdams
 
Order #188231367 (status writer assigned) role model albert e
Order #188231367 (status writer assigned) role model   albert eOrder #188231367 (status writer assigned) role model   albert e
Order #188231367 (status writer assigned) role model albert eJUST36
 
eXtensible Markup Language (By Dr.Hatem Mohamed)
eXtensible Markup Language (By Dr.Hatem Mohamed)eXtensible Markup Language (By Dr.Hatem Mohamed)
eXtensible Markup Language (By Dr.Hatem Mohamed)MUFIX Community
 
Services semantic technology_terminology
Services semantic technology_terminologyServices semantic technology_terminology
Services semantic technology_terminologyTenforce
 

What's hot (20)

XML and Related Technologies - Web Technologies (1019888BNR)
XML and Related Technologies - Web Technologies (1019888BNR)XML and Related Technologies - Web Technologies (1019888BNR)
XML and Related Technologies - Web Technologies (1019888BNR)
 
HTML and XML Difference FAQs
HTML and XML Difference FAQsHTML and XML Difference FAQs
HTML and XML Difference FAQs
 
Document object model(dom)
Document object model(dom)Document object model(dom)
Document object model(dom)
 
XML-Extensible Markup Language
XML-Extensible Markup Language XML-Extensible Markup Language
XML-Extensible Markup Language
 
Web data management (chapter-1)
Web data management (chapter-1)Web data management (chapter-1)
Web data management (chapter-1)
 
Web data management
Web data managementWeb data management
Web data management
 
XML
XMLXML
XML
 
Xml
XmlXml
Xml
 
XML - EXtensible Markup Language
XML - EXtensible Markup LanguageXML - EXtensible Markup Language
XML - EXtensible Markup Language
 
Xml dom
Xml domXml dom
Xml dom
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Extensible Markup Language (XML)
Extensible Markup Language (XML)Extensible Markup Language (XML)
Extensible Markup Language (XML)
 
XML.ppt
XML.pptXML.ppt
XML.ppt
 
10. XML in DBMS
10. XML in DBMS10. XML in DBMS
10. XML in DBMS
 
EXtensible Markup Language
EXtensible Markup LanguageEXtensible Markup Language
EXtensible Markup Language
 
An Introduction to the DOM
An Introduction to the DOMAn Introduction to the DOM
An Introduction to the DOM
 
Order #188231367 (status writer assigned) role model albert e
Order #188231367 (status writer assigned) role model   albert eOrder #188231367 (status writer assigned) role model   albert e
Order #188231367 (status writer assigned) role model albert e
 
eXtensible Markup Language (By Dr.Hatem Mohamed)
eXtensible Markup Language (By Dr.Hatem Mohamed)eXtensible Markup Language (By Dr.Hatem Mohamed)
eXtensible Markup Language (By Dr.Hatem Mohamed)
 
Markup Languages
Markup Languages Markup Languages
Markup Languages
 
Services semantic technology_terminology
Services semantic technology_terminologyServices semantic technology_terminology
Services semantic technology_terminology
 

Viewers also liked

Mdst3705 2013-02-26-db-as-genre
Mdst3705 2013-02-26-db-as-genreMdst3705 2013-02-26-db-as-genre
Mdst3705 2013-02-26-db-as-genreRafael Alvarado
 
UVA MDST 3703 2013 08-27 Introduction
UVA MDST 3703 2013 08-27 IntroductionUVA MDST 3703 2013 08-27 Introduction
UVA MDST 3703 2013 08-27 IntroductionRafael Alvarado
 
UVA MDST 3703 The Stack of Scholarship 2012-09-24
UVA MDST 3703 The Stack of Scholarship 2012-09-24UVA MDST 3703 The Stack of Scholarship 2012-09-24
UVA MDST 3703 The Stack of Scholarship 2012-09-24Rafael Alvarado
 
Mdst3703 shiva-2012-10-18
Mdst3703 shiva-2012-10-18Mdst3703 shiva-2012-10-18
Mdst3703 shiva-2012-10-18Rafael Alvarado
 
MDST 3703 F10 Seminar 14
MDST 3703 F10 Seminar 14MDST 3703 F10 Seminar 14
MDST 3703 F10 Seminar 14Rafael Alvarado
 
Mdst3703 graph-theory-11-20-2012
Mdst3703 graph-theory-11-20-2012Mdst3703 graph-theory-11-20-2012
Mdst3703 graph-theory-11-20-2012Rafael Alvarado
 

Viewers also liked (8)

Mdst3705 2013-02-26-db-as-genre
Mdst3705 2013-02-26-db-as-genreMdst3705 2013-02-26-db-as-genre
Mdst3705 2013-02-26-db-as-genre
 
UVA MDST 3703 2013 08-27 Introduction
UVA MDST 3703 2013 08-27 IntroductionUVA MDST 3703 2013 08-27 Introduction
UVA MDST 3703 2013 08-27 Introduction
 
UVA MDST 3703 The Stack of Scholarship 2012-09-24
UVA MDST 3703 The Stack of Scholarship 2012-09-24UVA MDST 3703 The Stack of Scholarship 2012-09-24
UVA MDST 3703 The Stack of Scholarship 2012-09-24
 
MDST 3703 F10 Studio 2
MDST 3703 F10 Studio 2 MDST 3703 F10 Studio 2
MDST 3703 F10 Studio 2
 
Mdst3703 shiva-2012-10-18
Mdst3703 shiva-2012-10-18Mdst3703 shiva-2012-10-18
Mdst3703 shiva-2012-10-18
 
Hd Overview
Hd OverviewHd Overview
Hd Overview
 
MDST 3703 F10 Seminar 14
MDST 3703 F10 Seminar 14MDST 3703 F10 Seminar 14
MDST 3703 F10 Seminar 14
 
Mdst3703 graph-theory-11-20-2012
Mdst3703 graph-theory-11-20-2012Mdst3703 graph-theory-11-20-2012
Mdst3703 graph-theory-11-20-2012
 

Similar to Mdst 3559-02-22-sql1

Trouble with nosql_dbs
Trouble with nosql_dbsTrouble with nosql_dbs
Trouble with nosql_dbsMurat Çakal
 
Open Source Databases Webinar
Open Source Databases WebinarOpen Source Databases Webinar
Open Source Databases WebinarMaxwell Pearl
 
PHP, The X DevAPI, and the MySQL Document Store -- Benelux PHP Confernece 2019
PHP, The X DevAPI, and the MySQL Document Store -- Benelux PHP Confernece 2019PHP, The X DevAPI, and the MySQL Document Store -- Benelux PHP Confernece 2019
PHP, The X DevAPI, and the MySQL Document Store -- Benelux PHP Confernece 2019Dave Stokes
 
PHP, The X DevAPI, and the MySQL Document Store Presented January 23rd, 20...
PHP,  The X DevAPI,  and the  MySQL Document Store Presented January 23rd, 20...PHP,  The X DevAPI,  and the  MySQL Document Store Presented January 23rd, 20...
PHP, The X DevAPI, and the MySQL Document Store Presented January 23rd, 20...Dave Stokes
 
DEE 431 Introduction to Mysql Slide 3
DEE 431 Introduction to Mysql Slide 3DEE 431 Introduction to Mysql Slide 3
DEE 431 Introduction to Mysql Slide 3YOGESH SINGH
 
Building Applications for SQL Server 2008
Building Applications for SQL Server 2008Building Applications for SQL Server 2008
Building Applications for SQL Server 2008Dave Bost
 
BCIT Application Portfolio Mgmt
BCIT Application Portfolio MgmtBCIT Application Portfolio Mgmt
BCIT Application Portfolio MgmtLeo de Sousa
 
XRX Presentation to Minnesota OTUG
XRX Presentation to Minnesota OTUGXRX Presentation to Minnesota OTUG
XRX Presentation to Minnesota OTUGOptum
 
Real World Sql Azure
Real World Sql AzureReal World Sql Azure
Real World Sql AzureJames Johnson
 
Linq to xml
Linq to xmlLinq to xml
Linq to xmlMickey
 
What should or not be programmed on the web
What should or not be programmed on the  webWhat should or not be programmed on the  web
What should or not be programmed on the webMohammad Kamrul Hasan
 
Technology
TechnologyTechnology
TechnologyRo Hith
 
Structured Dynamics' Semantic Technologies Product Stack
Structured Dynamics' Semantic Technologies Product StackStructured Dynamics' Semantic Technologies Product Stack
Structured Dynamics' Semantic Technologies Product StackMike Bergman
 
Advanced SQL - Database Access from Programming Languages
Advanced SQL - Database Access  from Programming LanguagesAdvanced SQL - Database Access  from Programming Languages
Advanced SQL - Database Access from Programming LanguagesS.Shayan Daneshvar
 

Similar to Mdst 3559-02-22-sql1 (20)

Trouble with nosql_dbs
Trouble with nosql_dbsTrouble with nosql_dbs
Trouble with nosql_dbs
 
Open Source Databases Webinar
Open Source Databases WebinarOpen Source Databases Webinar
Open Source Databases Webinar
 
PHP, The X DevAPI, and the MySQL Document Store -- Benelux PHP Confernece 2019
PHP, The X DevAPI, and the MySQL Document Store -- Benelux PHP Confernece 2019PHP, The X DevAPI, and the MySQL Document Store -- Benelux PHP Confernece 2019
PHP, The X DevAPI, and the MySQL Document Store -- Benelux PHP Confernece 2019
 
PHP, The X DevAPI, and the MySQL Document Store Presented January 23rd, 20...
PHP,  The X DevAPI,  and the  MySQL Document Store Presented January 23rd, 20...PHP,  The X DevAPI,  and the  MySQL Document Store Presented January 23rd, 20...
PHP, The X DevAPI, and the MySQL Document Store Presented January 23rd, 20...
 
DEE 431 Introduction to Mysql Slide 3
DEE 431 Introduction to Mysql Slide 3DEE 431 Introduction to Mysql Slide 3
DEE 431 Introduction to Mysql Slide 3
 
Building Applications for SQL Server 2008
Building Applications for SQL Server 2008Building Applications for SQL Server 2008
Building Applications for SQL Server 2008
 
BCIT Application Portfolio Mgmt
BCIT Application Portfolio MgmtBCIT Application Portfolio Mgmt
BCIT Application Portfolio Mgmt
 
XRX Presentation to Minnesota OTUG
XRX Presentation to Minnesota OTUGXRX Presentation to Minnesota OTUG
XRX Presentation to Minnesota OTUG
 
Real World Sql Azure
Real World Sql AzureReal World Sql Azure
Real World Sql Azure
 
Linq to xml
Linq to xmlLinq to xml
Linq to xml
 
What should or not be programmed on the web
What should or not be programmed on the  webWhat should or not be programmed on the  web
What should or not be programmed on the web
 
Mysql
MysqlMysql
Mysql
 
Technology
TechnologyTechnology
Technology
 
Website 101
Website 101Website 101
Website 101
 
Project seminar
Project seminarProject seminar
Project seminar
 
Structured Dynamics' Semantic Technologies Product Stack
Structured Dynamics' Semantic Technologies Product StackStructured Dynamics' Semantic Technologies Product Stack
Structured Dynamics' Semantic Technologies Product Stack
 
Database Systems Concepts, 5th Ed
Database Systems Concepts, 5th EdDatabase Systems Concepts, 5th Ed
Database Systems Concepts, 5th Ed
 
Introducing Oslo
Introducing OsloIntroducing Oslo
Introducing Oslo
 
Advanced SQL - Database Access from Programming Languages
Advanced SQL - Database Access  from Programming LanguagesAdvanced SQL - Database Access  from Programming Languages
Advanced SQL - Database Access from Programming Languages
 
Php
PhpPhp
Php
 

More from Rafael Alvarado

Mdst3703 2013-10-08-thematic-research-collections
Mdst3703 2013-10-08-thematic-research-collectionsMdst3703 2013-10-08-thematic-research-collections
Mdst3703 2013-10-08-thematic-research-collectionsRafael Alvarado
 
Mdst3703 2013-10-01-hypertext-and-history
Mdst3703 2013-10-01-hypertext-and-historyMdst3703 2013-10-01-hypertext-and-history
Mdst3703 2013-10-01-hypertext-and-historyRafael Alvarado
 
Mdst3703 2013-09-24-hypertext
Mdst3703 2013-09-24-hypertextMdst3703 2013-09-24-hypertext
Mdst3703 2013-09-24-hypertextRafael Alvarado
 
Mdst3703 2013-09-12-semantic-html
Mdst3703 2013-09-12-semantic-htmlMdst3703 2013-09-12-semantic-html
Mdst3703 2013-09-12-semantic-htmlRafael Alvarado
 
Mdst3703 2013-09-17-text-models
Mdst3703 2013-09-17-text-modelsMdst3703 2013-09-17-text-models
Mdst3703 2013-09-17-text-modelsRafael Alvarado
 
Mdst3703 2013-09-10-textual-signals
Mdst3703 2013-09-10-textual-signalsMdst3703 2013-09-10-textual-signals
Mdst3703 2013-09-10-textual-signalsRafael Alvarado
 
Mdst3703 2013-09-05-studio2
Mdst3703 2013-09-05-studio2Mdst3703 2013-09-05-studio2
Mdst3703 2013-09-05-studio2Rafael Alvarado
 
Mdst3703 2013-09-03-plato2
Mdst3703 2013-09-03-plato2Mdst3703 2013-09-03-plato2
Mdst3703 2013-09-03-plato2Rafael Alvarado
 
Mdst3703 2013-08-29-hello-world
Mdst3703 2013-08-29-hello-worldMdst3703 2013-08-29-hello-world
Mdst3703 2013-08-29-hello-worldRafael Alvarado
 
MDST 3705 2012-03-05 Databases to Visualization
MDST 3705 2012-03-05 Databases to VisualizationMDST 3705 2012-03-05 Databases to Visualization
MDST 3705 2012-03-05 Databases to VisualizationRafael Alvarado
 
Mdst3705 2013-02-19-text-into-data
Mdst3705 2013-02-19-text-into-dataMdst3705 2013-02-19-text-into-data
Mdst3705 2013-02-19-text-into-dataRafael Alvarado
 
Mdst3705 2013-02-12-finding-data
Mdst3705 2013-02-12-finding-dataMdst3705 2013-02-12-finding-data
Mdst3705 2013-02-12-finding-dataRafael Alvarado
 
Mdst3705 2013-02-05-databases
Mdst3705 2013-02-05-databasesMdst3705 2013-02-05-databases
Mdst3705 2013-02-05-databasesRafael Alvarado
 
Mdst3705 2013-01-29-praxis
Mdst3705 2013-01-29-praxisMdst3705 2013-01-29-praxis
Mdst3705 2013-01-29-praxisRafael Alvarado
 
Mdst3705 2013-01-31-php3
Mdst3705 2013-01-31-php3Mdst3705 2013-01-31-php3
Mdst3705 2013-01-31-php3Rafael Alvarado
 
Mdst3705 2012-01-22-code-as-language
Mdst3705 2012-01-22-code-as-languageMdst3705 2012-01-22-code-as-language
Mdst3705 2012-01-22-code-as-languageRafael Alvarado
 
Mdst3705 2013-01-24-php2
Mdst3705 2013-01-24-php2Mdst3705 2013-01-24-php2
Mdst3705 2013-01-24-php2Rafael Alvarado
 
Mdst3705 2012-01-15-introduction
Mdst3705 2012-01-15-introductionMdst3705 2012-01-15-introduction
Mdst3705 2012-01-15-introductionRafael Alvarado
 
Mdst3703 maps-and-timelines-2012-11-13
Mdst3703 maps-and-timelines-2012-11-13Mdst3703 maps-and-timelines-2012-11-13
Mdst3703 maps-and-timelines-2012-11-13Rafael Alvarado
 

More from Rafael Alvarado (20)

Mdst3703 2013-10-08-thematic-research-collections
Mdst3703 2013-10-08-thematic-research-collectionsMdst3703 2013-10-08-thematic-research-collections
Mdst3703 2013-10-08-thematic-research-collections
 
Mdst3703 2013-10-01-hypertext-and-history
Mdst3703 2013-10-01-hypertext-and-historyMdst3703 2013-10-01-hypertext-and-history
Mdst3703 2013-10-01-hypertext-and-history
 
Mdst3703 2013-09-24-hypertext
Mdst3703 2013-09-24-hypertextMdst3703 2013-09-24-hypertext
Mdst3703 2013-09-24-hypertext
 
Presentation1
Presentation1Presentation1
Presentation1
 
Mdst3703 2013-09-12-semantic-html
Mdst3703 2013-09-12-semantic-htmlMdst3703 2013-09-12-semantic-html
Mdst3703 2013-09-12-semantic-html
 
Mdst3703 2013-09-17-text-models
Mdst3703 2013-09-17-text-modelsMdst3703 2013-09-17-text-models
Mdst3703 2013-09-17-text-models
 
Mdst3703 2013-09-10-textual-signals
Mdst3703 2013-09-10-textual-signalsMdst3703 2013-09-10-textual-signals
Mdst3703 2013-09-10-textual-signals
 
Mdst3703 2013-09-05-studio2
Mdst3703 2013-09-05-studio2Mdst3703 2013-09-05-studio2
Mdst3703 2013-09-05-studio2
 
Mdst3703 2013-09-03-plato2
Mdst3703 2013-09-03-plato2Mdst3703 2013-09-03-plato2
Mdst3703 2013-09-03-plato2
 
Mdst3703 2013-08-29-hello-world
Mdst3703 2013-08-29-hello-worldMdst3703 2013-08-29-hello-world
Mdst3703 2013-08-29-hello-world
 
MDST 3705 2012-03-05 Databases to Visualization
MDST 3705 2012-03-05 Databases to VisualizationMDST 3705 2012-03-05 Databases to Visualization
MDST 3705 2012-03-05 Databases to Visualization
 
Mdst3705 2013-02-19-text-into-data
Mdst3705 2013-02-19-text-into-dataMdst3705 2013-02-19-text-into-data
Mdst3705 2013-02-19-text-into-data
 
Mdst3705 2013-02-12-finding-data
Mdst3705 2013-02-12-finding-dataMdst3705 2013-02-12-finding-data
Mdst3705 2013-02-12-finding-data
 
Mdst3705 2013-02-05-databases
Mdst3705 2013-02-05-databasesMdst3705 2013-02-05-databases
Mdst3705 2013-02-05-databases
 
Mdst3705 2013-01-29-praxis
Mdst3705 2013-01-29-praxisMdst3705 2013-01-29-praxis
Mdst3705 2013-01-29-praxis
 
Mdst3705 2013-01-31-php3
Mdst3705 2013-01-31-php3Mdst3705 2013-01-31-php3
Mdst3705 2013-01-31-php3
 
Mdst3705 2012-01-22-code-as-language
Mdst3705 2012-01-22-code-as-languageMdst3705 2012-01-22-code-as-language
Mdst3705 2012-01-22-code-as-language
 
Mdst3705 2013-01-24-php2
Mdst3705 2013-01-24-php2Mdst3705 2013-01-24-php2
Mdst3705 2013-01-24-php2
 
Mdst3705 2012-01-15-introduction
Mdst3705 2012-01-15-introductionMdst3705 2012-01-15-introduction
Mdst3705 2012-01-15-introduction
 
Mdst3703 maps-and-timelines-2012-11-13
Mdst3703 maps-and-timelines-2012-11-13Mdst3703 maps-and-timelines-2012-11-13
Mdst3703 maps-and-timelines-2012-11-13
 

Mdst 3559-02-22-sql1

  • 1. SQL 1 MDST 3559: DataestheticsProf. Alvarado02/22/2011
  • 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
  • 6. What does data look like? How is it organized?
  • 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”;
  • 8. What do these structures have in common?
  • 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
  • 11. Example What are the categories? Instances? Values?
  • 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