SlideShare una empresa de Scribd logo
1 de 15
Week 3
Assignment
• 2 Part Assignment Patchwork and Narrative
• Patchwork:
  – Somewhere to put it..
     • Blogger / Wordpress / whatever
  – Something to put there
     • Screenshots, links of things we’ve done in class
     • Links to cool things you’ve found
     • And what do you honestly think about it?
  – Start with your Facebook Gephi diagram?
Relational Databases
• Install MySQL
  – XAMPP, MAMP, WAMP
• Last week we created databases from the
  MySQL command prompt
Relational Databases
/Applications/MAMP/Library/bin/mysql --host=localhost -uroot –proot

•   As many items as possible:
•   Created a database
     –   create database 'test’;
     –   Use test;
     –   Create
     –   create table test( ID INT(5), TITLE VARCHAR(100) );

     INSERT INTO test VALUES (5, “test”);



•   I did it in php
•   I got Bored
•   Video:
PHP loop
set_time_limit(0);
error_reporting(E_ALL);
ini_set('display_errors', '1');

$db = new db();

$x = 2;
$number = 1;

$filename="/usr/share/dict/words";
$words=file($filename);


while ($x < 10) {

      shuffle($words);
      $word=$words[0];

            $db->Query("INSERT INTO test (ID, Name) VALUE ($number, '$word')");

      $number++;
}
94 000 records in a few minutes
indexs
• Default index in mysql is a datastructure called
  a b-tree
• When you create a primary key is creates a b-
  tree
• Like an index in a book
BTREE EXAMPLE




http://www.youtube.com/watch?v=coRJrcIYbF
4



               Helps to Speed up joins
Joining Tables –Shop Database
Create database shop;

use shop;

CREATE TABLE suppliers (
     id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
     supplier_name VARCHAR(100),
     supplier_address VARCHAR(100)
   );

    CREATE TABLE products (
     id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
     prod_name VARCHAR(100),
     prod_desc VARCHAR(100),
      supplier_id INT
   );
Shop Database
INSERT INTO suppliers (supplier_name, supplier_address)
   VALUES
   ("Microsoft", "Microsoft Road") , ("Apple", "Apple Lane");


    INSERT INTO products (prod_name, prod_desc, supplier_id)
   VALUES
   ("iPhone", "Mobile Phone", "2") , ("Xbox 360", "Games Machine", "1");

   select * from suppliers
   select * from products

   Select supplier_name, prod_name from suppliers, products;

SELECT prod_name, supplier_name, supplier_address FROM products, suppliers
WHERE (products.supplier_id = suppliers.id);

http://www.techotopia.com/index.php/Joining_Tables_in_MySQL
Relational Databases
collection of data items organized as a set of formally described tables
Relationships!
NoSQL databases (Not only SQL
• non-adherence to the widely used relational
  database management system mode
  – Document Stores
     • Data stored in encodings such as XML, JSON etc
  – Graph Database
  – Key Value Store
Rows and Rows
Week3 adb

Más contenido relacionado

La actualidad más candente

Getting Creative with WordPress Queries
Getting Creative with WordPress QueriesGetting Creative with WordPress Queries
Getting Creative with WordPress QueriesDrewAPicture
 
The Best (and Worst) of Django
The Best (and Worst) of DjangoThe Best (and Worst) of Django
The Best (and Worst) of DjangoJacob Kaplan-Moss
 
Introducing ExtReact: Adding Powerful Sencha Components to React Apps
Introducing ExtReact: Adding Powerful Sencha Components to React AppsIntroducing ExtReact: Adding Powerful Sencha Components to React Apps
Introducing ExtReact: Adding Powerful Sencha Components to React AppsSencha
 
Task 1
Task 1Task 1
Task 1EdiPHP
 
Transforming WordPress Search and Query Performance with Elasticsearch
Transforming WordPress Search and Query Performance with Elasticsearch Transforming WordPress Search and Query Performance with Elasticsearch
Transforming WordPress Search and Query Performance with Elasticsearch Taylor Lovett
 
2011/10/08_Playframework_GAE_to_Heroku
2011/10/08_Playframework_GAE_to_Heroku2011/10/08_Playframework_GAE_to_Heroku
2011/10/08_Playframework_GAE_to_HerokuTakeshi Hagikura
 
What You Missed in Computer Science
What You Missed in Computer ScienceWhat You Missed in Computer Science
What You Missed in Computer ScienceTaylor Lovett
 
You Don't Know Query (WordCamp Netherlands 2012)
You Don't Know Query (WordCamp Netherlands 2012)You Don't Know Query (WordCamp Netherlands 2012)
You Don't Know Query (WordCamp Netherlands 2012)andrewnacin
 
ニコニコ動画を検索可能にしてみよう
ニコニコ動画を検索可能にしてみようニコニコ動画を検索可能にしてみよう
ニコニコ動画を検索可能にしてみようgenta kaneyama
 
Modernizing WordPress Search with Elasticsearch
Modernizing WordPress Search with ElasticsearchModernizing WordPress Search with Elasticsearch
Modernizing WordPress Search with ElasticsearchTaylor Lovett
 
5分で説明する Play! scala
5分で説明する Play! scala5分で説明する Play! scala
5分で説明する Play! scalamasahitojp
 
Modules Building Presentation
Modules Building PresentationModules Building Presentation
Modules Building Presentationhtyson
 
Web Application Development using PHP Chapter 7
Web Application Development using PHP Chapter 7Web Application Development using PHP Chapter 7
Web Application Development using PHP Chapter 7Mohd Harris Ahmad Jaal
 
Moose - YAPC::NA 2012
Moose - YAPC::NA 2012Moose - YAPC::NA 2012
Moose - YAPC::NA 2012xSawyer
 
Djangocon 2014 - Django REST Framework - So Easy You Can Learn it in 25 Minutes
Djangocon 2014 - Django REST Framework - So Easy You Can Learn it in 25 MinutesDjangocon 2014 - Django REST Framework - So Easy You Can Learn it in 25 Minutes
Djangocon 2014 - Django REST Framework - So Easy You Can Learn it in 25 MinutesNina Zakharenko
 
Debugging and Testing ES Systems
Debugging and Testing ES SystemsDebugging and Testing ES Systems
Debugging and Testing ES SystemsChris Birchall
 
Building a Testable Data Access Layer
Building a Testable Data Access LayerBuilding a Testable Data Access Layer
Building a Testable Data Access LayerTodd Anglin
 
Drupal 8: A story of growing up and getting off the island
Drupal 8: A story of growing up and getting off the islandDrupal 8: A story of growing up and getting off the island
Drupal 8: A story of growing up and getting off the islandAngela Byron
 
Manage WordPress with Awesome using wp cli
Manage WordPress with Awesome using wp cliManage WordPress with Awesome using wp cli
Manage WordPress with Awesome using wp cliGetSource
 

La actualidad más candente (20)

Getting Creative with WordPress Queries
Getting Creative with WordPress QueriesGetting Creative with WordPress Queries
Getting Creative with WordPress Queries
 
The Best (and Worst) of Django
The Best (and Worst) of DjangoThe Best (and Worst) of Django
The Best (and Worst) of Django
 
Introducing ExtReact: Adding Powerful Sencha Components to React Apps
Introducing ExtReact: Adding Powerful Sencha Components to React AppsIntroducing ExtReact: Adding Powerful Sencha Components to React Apps
Introducing ExtReact: Adding Powerful Sencha Components to React Apps
 
Task 1
Task 1Task 1
Task 1
 
Transforming WordPress Search and Query Performance with Elasticsearch
Transforming WordPress Search and Query Performance with Elasticsearch Transforming WordPress Search and Query Performance with Elasticsearch
Transforming WordPress Search and Query Performance with Elasticsearch
 
2011/10/08_Playframework_GAE_to_Heroku
2011/10/08_Playframework_GAE_to_Heroku2011/10/08_Playframework_GAE_to_Heroku
2011/10/08_Playframework_GAE_to_Heroku
 
What You Missed in Computer Science
What You Missed in Computer ScienceWhat You Missed in Computer Science
What You Missed in Computer Science
 
You Don't Know Query (WordCamp Netherlands 2012)
You Don't Know Query (WordCamp Netherlands 2012)You Don't Know Query (WordCamp Netherlands 2012)
You Don't Know Query (WordCamp Netherlands 2012)
 
ニコニコ動画を検索可能にしてみよう
ニコニコ動画を検索可能にしてみようニコニコ動画を検索可能にしてみよう
ニコニコ動画を検索可能にしてみよう
 
Modernizing WordPress Search with Elasticsearch
Modernizing WordPress Search with ElasticsearchModernizing WordPress Search with Elasticsearch
Modernizing WordPress Search with Elasticsearch
 
5分で説明する Play! scala
5分で説明する Play! scala5分で説明する Play! scala
5分で説明する Play! scala
 
Modules Building Presentation
Modules Building PresentationModules Building Presentation
Modules Building Presentation
 
Moose
MooseMoose
Moose
 
Web Application Development using PHP Chapter 7
Web Application Development using PHP Chapter 7Web Application Development using PHP Chapter 7
Web Application Development using PHP Chapter 7
 
Moose - YAPC::NA 2012
Moose - YAPC::NA 2012Moose - YAPC::NA 2012
Moose - YAPC::NA 2012
 
Djangocon 2014 - Django REST Framework - So Easy You Can Learn it in 25 Minutes
Djangocon 2014 - Django REST Framework - So Easy You Can Learn it in 25 MinutesDjangocon 2014 - Django REST Framework - So Easy You Can Learn it in 25 Minutes
Djangocon 2014 - Django REST Framework - So Easy You Can Learn it in 25 Minutes
 
Debugging and Testing ES Systems
Debugging and Testing ES SystemsDebugging and Testing ES Systems
Debugging and Testing ES Systems
 
Building a Testable Data Access Layer
Building a Testable Data Access LayerBuilding a Testable Data Access Layer
Building a Testable Data Access Layer
 
Drupal 8: A story of growing up and getting off the island
Drupal 8: A story of growing up and getting off the islandDrupal 8: A story of growing up and getting off the island
Drupal 8: A story of growing up and getting off the island
 
Manage WordPress with Awesome using wp cli
Manage WordPress with Awesome using wp cliManage WordPress with Awesome using wp cli
Manage WordPress with Awesome using wp cli
 

Destacado (17)

Week6
Week6Week6
Week6
 
Flashtalk david
Flashtalk davidFlashtalk david
Flashtalk david
 
Aplikasi determinan dalam geometri
Aplikasi determinan dalam geometriAplikasi determinan dalam geometri
Aplikasi determinan dalam geometri
 
χοροι
χοροιχοροι
χοροι
 
Revision
RevisionRevision
Revision
 
Agent Based Models
Agent Based ModelsAgent Based Models
Agent Based Models
 
Recognizing Human-Object Interactions in Still Images by Modeling the Mutual ...
Recognizing Human-Object Interactions inStill Images by Modeling the Mutual ...Recognizing Human-Object Interactions inStill Images by Modeling the Mutual ...
Recognizing Human-Object Interactions in Still Images by Modeling the Mutual ...
 
public cloud security via ids
public cloud security via idspublic cloud security via ids
public cloud security via ids
 
Dos presentation by ahlam shakeel
Dos presentation by ahlam shakeelDos presentation by ahlam shakeel
Dos presentation by ahlam shakeel
 
Soa
SoaSoa
Soa
 
Html5 offers 5 times better ways to hijack the website
Html5 offers 5 times better ways to hijack the website Html5 offers 5 times better ways to hijack the website
Html5 offers 5 times better ways to hijack the website
 
grid authentication
grid authenticationgrid authentication
grid authentication
 
Rbac
RbacRbac
Rbac
 
Operating system vulnerability and control
Operating system vulnerability and control Operating system vulnerability and control
Operating system vulnerability and control
 
Image based authentication
Image based authenticationImage based authentication
Image based authentication
 
Dmz
Dmz Dmz
Dmz
 
Grid computing by ahlam ansari
Grid computing by  ahlam ansariGrid computing by  ahlam ansari
Grid computing by ahlam ansari
 

Similar a Week3 adb

Quality Assurance for PHP projects - ZendCon 2012
Quality Assurance for PHP projects - ZendCon 2012Quality Assurance for PHP projects - ZendCon 2012
Quality Assurance for PHP projects - ZendCon 2012Michelangelo van Dam
 
Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12Michelangelo van Dam
 
[WLDN] Supercharging word press development in 2018
[WLDN] Supercharging word press development in 2018[WLDN] Supercharging word press development in 2018
[WLDN] Supercharging word press development in 2018Adam Tomat
 
Scaling php applications with redis
Scaling php applications with redisScaling php applications with redis
Scaling php applications with redisjimbojsb
 
Bioinformatics p5-bioperl v2013-wim_vancriekinge
Bioinformatics p5-bioperl v2013-wim_vancriekingeBioinformatics p5-bioperl v2013-wim_vancriekinge
Bioinformatics p5-bioperl v2013-wim_vancriekingeProf. Wim Van Criekinge
 
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)Mike Schinkel
 
Supercharging WordPress Development in 2018
Supercharging WordPress Development in 2018Supercharging WordPress Development in 2018
Supercharging WordPress Development in 2018Adam Tomat
 
Intro to php
Intro to phpIntro to php
Intro to phpSp Singh
 
Advanced Php - Macq Electronique 2010
Advanced Php - Macq Electronique 2010Advanced Php - Macq Electronique 2010
Advanced Php - Macq Electronique 2010Michelangelo van Dam
 
Redis for your boss 2.0
Redis for your boss 2.0Redis for your boss 2.0
Redis for your boss 2.0Elena Kolevska
 
PHP Basics and Demo HackU
PHP Basics and Demo HackUPHP Basics and Demo HackU
PHP Basics and Demo HackUAnshu Prateek
 

Similar a Week3 adb (20)

Quality Assurance for PHP projects - ZendCon 2012
Quality Assurance for PHP projects - ZendCon 2012Quality Assurance for PHP projects - ZendCon 2012
Quality Assurance for PHP projects - ZendCon 2012
 
Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12
 
Php Training Workshop by Vtips
Php Training Workshop by VtipsPhp Training Workshop by Vtips
Php Training Workshop by Vtips
 
[WLDN] Supercharging word press development in 2018
[WLDN] Supercharging word press development in 2018[WLDN] Supercharging word press development in 2018
[WLDN] Supercharging word press development in 2018
 
PostgreSQL
PostgreSQLPostgreSQL
PostgreSQL
 
Scaling php applications with redis
Scaling php applications with redisScaling php applications with redis
Scaling php applications with redis
 
Bioinformatica p6-bioperl
Bioinformatica p6-bioperlBioinformatica p6-bioperl
Bioinformatica p6-bioperl
 
CakePHP
CakePHPCakePHP
CakePHP
 
Bioinformatics p5-bioperl v2013-wim_vancriekinge
Bioinformatics p5-bioperl v2013-wim_vancriekingeBioinformatics p5-bioperl v2013-wim_vancriekinge
Bioinformatics p5-bioperl v2013-wim_vancriekinge
 
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
 
php2.pptx
php2.pptxphp2.pptx
php2.pptx
 
Php summary
Php summaryPhp summary
Php summary
 
MYSQL - PHP Database Connectivity
MYSQL - PHP Database ConnectivityMYSQL - PHP Database Connectivity
MYSQL - PHP Database Connectivity
 
Supercharging WordPress Development in 2018
Supercharging WordPress Development in 2018Supercharging WordPress Development in 2018
Supercharging WordPress Development in 2018
 
Intro to php
Intro to phpIntro to php
Intro to php
 
Advanced Php - Macq Electronique 2010
Advanced Php - Macq Electronique 2010Advanced Php - Macq Electronique 2010
Advanced Php - Macq Electronique 2010
 
MySQL with PHP
MySQL with PHPMySQL with PHP
MySQL with PHP
 
2012 03 08_dbi
2012 03 08_dbi2012 03 08_dbi
2012 03 08_dbi
 
Redis for your boss 2.0
Redis for your boss 2.0Redis for your boss 2.0
Redis for your boss 2.0
 
PHP Basics and Demo HackU
PHP Basics and Demo HackUPHP Basics and Demo HackU
PHP Basics and Demo HackU
 

Week3 adb

  • 2. Assignment • 2 Part Assignment Patchwork and Narrative • Patchwork: – Somewhere to put it.. • Blogger / Wordpress / whatever – Something to put there • Screenshots, links of things we’ve done in class • Links to cool things you’ve found • And what do you honestly think about it? – Start with your Facebook Gephi diagram?
  • 3. Relational Databases • Install MySQL – XAMPP, MAMP, WAMP • Last week we created databases from the MySQL command prompt
  • 4. Relational Databases /Applications/MAMP/Library/bin/mysql --host=localhost -uroot –proot • As many items as possible: • Created a database – create database 'test’; – Use test; – Create – create table test( ID INT(5), TITLE VARCHAR(100) ); INSERT INTO test VALUES (5, “test”); • I did it in php • I got Bored • Video:
  • 5. PHP loop set_time_limit(0); error_reporting(E_ALL); ini_set('display_errors', '1'); $db = new db(); $x = 2; $number = 1; $filename="/usr/share/dict/words"; $words=file($filename); while ($x < 10) { shuffle($words); $word=$words[0]; $db->Query("INSERT INTO test (ID, Name) VALUE ($number, '$word')"); $number++; }
  • 6. 94 000 records in a few minutes
  • 7. indexs • Default index in mysql is a datastructure called a b-tree • When you create a primary key is creates a b- tree • Like an index in a book
  • 9. Joining Tables –Shop Database Create database shop; use shop; CREATE TABLE suppliers ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, supplier_name VARCHAR(100), supplier_address VARCHAR(100) ); CREATE TABLE products ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, prod_name VARCHAR(100), prod_desc VARCHAR(100), supplier_id INT );
  • 10. Shop Database INSERT INTO suppliers (supplier_name, supplier_address) VALUES ("Microsoft", "Microsoft Road") , ("Apple", "Apple Lane"); INSERT INTO products (prod_name, prod_desc, supplier_id) VALUES ("iPhone", "Mobile Phone", "2") , ("Xbox 360", "Games Machine", "1"); select * from suppliers select * from products Select supplier_name, prod_name from suppliers, products; SELECT prod_name, supplier_name, supplier_address FROM products, suppliers WHERE (products.supplier_id = suppliers.id); http://www.techotopia.com/index.php/Joining_Tables_in_MySQL
  • 11. Relational Databases collection of data items organized as a set of formally described tables
  • 13. NoSQL databases (Not only SQL • non-adherence to the widely used relational database management system mode – Document Stores • Data stored in encodings such as XML, JSON etc – Graph Database – Key Value Store