Advertisement
TermSpar

Programmers Database

Apr 9th, 2016
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 2.63 KB | None | 0 0
  1. /*I did all my own research for this */
  2.  
  3. CREATE TABLE programmers(
  4.     id INTEGER PRIMARY KEY AUTOINCREMENT,
  5.     company TEXT,
  6.     name TEXT
  7. );
  8.  
  9. CREATE TABLE software(
  10. id INTEGER PRIMARY KEY AUTOINCREMENT,
  11.     name TEXT,
  12.     programmer_id INTEGER
  13. );
  14.  
  15. INSERT INTO programmers (name, company) VALUES ('Steve Jobs', 'Apple');
  16.  
  17. INSERT INTO programmers (name, company) VALUES ('Steve Wozniak', 'Apple');
  18.  
  19. INSERT INTO programmers (name, company) VALUES ('Bill Gates', 'Microsoft');
  20.  
  21. INSERT INTO programmers (name, company) VALUES ('Paul Allen', 'Microsoft');
  22.  
  23. INSERT INTO programmers (name, company) VALUES ('Larry Page', 'Google');
  24.  
  25. INSERT INTO programmers (name, company) VALUES ('Sergey Brin', 'Google');
  26.  
  27. INSERT INTO programmers (name, company) VALUES ('Bjarne Stroustrup', null);
  28.  
  29. INSERT INTO programmers (name, company) VALUES ('James Gosling', 'Oracle');
  30.  
  31. INSERT INTO programmers (name, company) VALUES ('Guido van Rossum', 'Dropbox');
  32.  
  33. INSERT INTO programmers (name, company) VALUES ('Tim Berners-Lee', 'World Wide Web Consortium');
  34.  
  35. INSERT INTO programmers (name, company) VALUES ('Rasmus Lerdorf', null);
  36.  
  37. INSERT INTO programmers (name, company) VALUES ('Donald D. Chamberlin', 'IBM');
  38.  
  39. INSERT INTO programmers (name, company) VALUES ('Raymond F. Boyce', 'IBM');
  40.  
  41. INSERT INTO programmers (name, company) VALUES ('Brendan Eich', null);
  42.  
  43. INSERT INTO programmers (name, company) VALUES ('Mark Zuckerberg', null);
  44.  
  45.  
  46.  
  47.  
  48. INSERT INTO software (name, programmer_id) VALUES ('Macintosh', 1);
  49.  
  50. INSERT INTO software (name, programmer_id) VALUES ('Mac OSX', 2);
  51.  
  52. INSERT INTO software (name, programmer_id) VALUES ('Windows', 3);
  53.  
  54. INSERT INTO software (name, programmer_id) VALUES ('Microsoft Products', 4);
  55.  
  56. INSERT INTO software (name, programmer_id) VALUES ('Google', 5);
  57.  
  58. INSERT INTO software (name, programmer_id) VALUES ('Google Products', 6);
  59.  
  60. INSERT INTO software (name, programmer_id) VALUES ('C++', 7);
  61.  
  62. INSERT INTO software (name, programmer_id) VALUES ('Java', 8);
  63.  
  64. INSERT INTO software (name, programmer_id) VALUES ('Python', 9);
  65.  
  66. INSERT INTO software (name, programmer_id) VALUES ('HTML', 10);
  67.  
  68. INSERT INTO software (name, programmer_id) VALUES ('PHP', 11);
  69.  
  70. INSERT INTO software (name, programmer_id) VALUES ('SQL', 12);
  71.  
  72. INSERT INTO software (name, programmer_id) VALUES ('SQL', 13);
  73.  
  74. INSERT INTO software (name, programmer_id) VALUES ('JavaScript', 14);
  75.  
  76. INSERT INTO software (name, programmer_id) VALUES ('Facebook', 15);
  77.  
  78.  
  79. SELECT programmers.name AS "Name", programmers.company AS "Company",
  80. software.name AS "Product" FROM programmers
  81. LEFT OUTER JOIN software
  82. ON software.programmer_id = programmers.id;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement