Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How the Web Works: Lecture 5

How the Web Works: Lecture 5

This talk was designed for a class (98-135) taught at Carnegie Mellon University in Spring 2010.

Abhinav Sharma

January 09, 2014
Tweet

More Decks by Abhinav Sharma

Other Decks in Education

Transcript

  1. Database Queries How many students? What professors can teach? Course

    Prereqs? Rooms of correct size? Days per week? etc......
  2. Student Wanted Courses Allowed Units All Courses Alpha 251 213

    66 251 211 213 272 212 410 437 381 451 Beta 272 211 59 251 211 213 272 212 410 437 381 451 Gamma 410 437 66 251 211 213 272 212 410 437 381 451
  3. Student Wanted Courses Allowed Units All Courses Alpha 251 213

    66 251 211 213 272 212 410 437 381 451 Beta 272 211 59 251 211 213 272 212 410 437 381 451 Gamma 410 437 66 251 211 213 272 212 410 437 381 451 Repetition Fail
  4. Student Wanted Courses Allowed Units Alpha 251 213 66 Beta

    272 211 59 ... ... ... Course Units Space 410 12 50 211 12 80 ... ... ... Students Courses
  5. Database Queries How many students? What professors can teach? Course

    Prereqs? Rooms of correct size? Days per week? etc......
  6. Database Queries SELECT COUNT(*) FROM STUDENTS SELECT PROFS FROM COURSES

    WHERE COURSE = 410 SELECT PREREQS FROM COURSES WHERE COURSE = 251 SELECT RSIZE FROM COURSES WHERE COURSE = 410 SELECT ROOM FROM ROOMS WHERE SIZE = RSIZE SELECT DAYS FROM COURSES WHERE COURSE = 211 SELECT ROOM FROM ROOMS WHERE AVAIL = DAYS
  7. Database Queries SELECT COUNT(*) FROM STUDENTS SELECT PROFS FROM COURSES

    WHERE COURSE = 410 SELECT PREREQS FROM COURSES WHERE COURSE = 251 SELECT RSIZE FROM COURSES WHERE COURSE = 410 SELECT ROOM FROM ROOMS WHERE SIZE = RSIZE SELECT DAYS FROM COURSES WHERE COURSE = 211 SELECT ROOM FROM ROOMS WHERE AVAIL = DAYS Useful, Right?
  8. MySQL Is a Query Language Interfaces User and DB SQL

    is a general idea MySQL is an implementation Free, Open Source The ‘M’ in LAMP
  9. Updating UPDATE STUDENTS SET gpa = 4, college = “mcs”

    WHERE name = ‘Alpha’; name gpa college Alpha 3 scs Beta 3.2 cit Gamma 4 hss
  10. Updating UPDATE STUDENTS SET gpa = 4, college = “mcs”

    WHERE name = ‘Alpha’; name gpa college Alpha 4 mcs Beta 3.2 cit Gamma 4 hss
  11. Selecting SELECT (college, gpa) FROM STUDENTS WHERE name = “Alpha”

    OR name = “Beta”; name gpa college Alpha 4 scs Beta 3.2 cit Gamma 4 hss
  12. Deleting DELETE FROM STUDENTS WHERE name = “Alpha”; name gpa

    college Alpha 4 scs Beta 3.2 cit Gamma 4 hss
  13. Deleting DELETE FROM STUDENTS WHERE name = “Alpha”; name gpa

    college Alpha 4 scs Beta 3.2 cit Gamma 4 hss
  14. MySQL Just Bare Essentials < 5% of what MySQL can

    do but you can be useful! Read Up Online (Check Blog) Take 15-415 http://w3schools.com/sql/
  15. Still Boring, Eh? Think Performance Lookup in Big Table vs.

    Small Space Saved from Repetition Means to and end It gets better...
  16. PhpMyAdmin Made in PHP GUI Interface to Tables Useful for

    Setting Up Can Generate Query Code Comes with XAMPP Beware!
  17. PHP & MySQL Super Popular Easy to Use - MySQLi

    Host User, Password, Database Tables
  18. Why? Because I’m too quick! SQL is dull =( I

    like this stuff I couldn’t wait All over the web... Don’t believe me?
  19. More Seriously... Naive Bayes Clustering k-Nearest Neighbours Take 15-381 or

    10-601 Read the Books (PCI is easier) ML is Awesome Netflix Prize: $1 Million