Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added Complete.sql to make it easier to setup new databases

  • Loading branch information...
commit ed246fb6019fbc0efd7becdb4d031f7251816492 1 parent 0fc3d4d
authored

Showing 1 changed file with 51 additions and 0 deletions. Show diff stats Hide diff stats

  1. +51 0 lecture/sql/setup/Complete.sql
51 lecture/sql/setup/Complete.sql
... ... @@ -0,0 +1,51 @@
  1 +-- Create tables --
  2 +drop table if exists College;
  3 +drop table if exists Student;
  4 +drop table if exists Apply;
  5 +
  6 +create table College(cName text, state text, enrollment int);
  7 +create table Student(sID int, sName text, GPA real, sizeHS int);
  8 +create table Apply(sID int, cName text, major text, decision text);
  9 +
  10 +-- Populate tables --
  11 +delete from Student;
  12 +delete from College;
  13 +delete from Apply;
  14 +
  15 +insert into Student values (123, 'Amy', 3.9, 1000);
  16 +insert into Student values (234, 'Bob', 3.6, 1500);
  17 +insert into Student values (345, 'Craig', 3.5, 500);
  18 +insert into Student values (456, 'Doris', 3.9, 1000);
  19 +insert into Student values (567, 'Edward', 2.9, 2000);
  20 +insert into Student values (678, 'Fay', 3.8, 200);
  21 +insert into Student values (789, 'Gary', 3.4, 800);
  22 +insert into Student values (987, 'Helen', 3.7, 800);
  23 +insert into Student values (876, 'Irene', 3.9, 400);
  24 +insert into Student values (765, 'Jay', 2.9, 1500);
  25 +insert into Student values (654, 'Amy', 3.9, 1000);
  26 +insert into Student values (543, 'Craig', 3.4, 2000);
  27 +
  28 +insert into College values ('Stanford', 'CA', 15000);
  29 +insert into College values ('Berkeley', 'CA', 36000);
  30 +insert into College values ('MIT', 'MA', 10000);
  31 +insert into College values ('Cornell', 'NY', 21000);
  32 +
  33 +insert into Apply values (123, 'Stanford', 'CS', 'Y');
  34 +insert into Apply values (123, 'Stanford', 'EE', 'N');
  35 +insert into Apply values (123, 'Berkeley', 'CS', 'Y');
  36 +insert into Apply values (123, 'Cornell', 'EE', 'Y');
  37 +insert into Apply values (234, 'Berkeley', 'biology', 'N');
  38 +insert into Apply values (345, 'MIT', 'bioengineering', 'Y');
  39 +insert into Apply values (345, 'Cornell', 'bioengineering', 'N');
  40 +insert into Apply values (345, 'Cornell', 'CS', 'Y');
  41 +insert into Apply values (345, 'Cornell', 'EE', 'N');
  42 +insert into Apply values (678, 'Stanford', 'history', 'Y');
  43 +insert into Apply values (987, 'Stanford', 'CS', 'Y');
  44 +insert into Apply values (987, 'Berkeley', 'CS', 'Y');
  45 +insert into Apply values (876, 'Stanford', 'CS', 'N');
  46 +insert into Apply values (876, 'MIT', 'biology', 'Y');
  47 +insert into Apply values (876, 'MIT', 'marine biology', 'N');
  48 +insert into Apply values (765, 'Stanford', 'history', 'Y');
  49 +insert into Apply values (765, 'Cornell', 'history', 'N');
  50 +insert into Apply values (765, 'Cornell', 'psychology', 'Y');
  51 +insert into Apply values (543, 'MIT', 'CS', 'N');

0 comments on commit ed246fb

Please sign in to comment.
Something went wrong with that request. Please try again.