examples/sql/transp.sql
changeset 1 c445c931472f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/examples/sql/transp.sql	Mon Dec 06 13:09:21 2010 +0100
     1.3 @@ -0,0 +1,45 @@
     1.4 +CREATE DATABASE glpk;
     1.5 +CREATE USER glpk@localhost IDENTIFIED BY 'gnu';
     1.6 +GRANT ALL PRIVILEGES ON glpk.* TO glpk@localhost;
     1.7 +USE glpk;
     1.8 +# production capacity
     1.9 +DROP TABLE transp_capa;
    1.10 +CREATE TABLE transp_capa (
    1.11 +  PLANT TEXT(127),
    1.12 +  CAPA  REAL,
    1.13 +  PRIMARY KEY ( PLANT(127) )
    1.14 +  );
    1.15 +INSERT INTO transp_capa ( PLANT, CAPA ) VALUES ( 'Seattle',   350 );
    1.16 +INSERT INTO transp_capa ( PLANT, CAPA ) VALUES ( 'San Diego', 600 );
    1.17 +# demand
    1.18 +DROP TABLE transp_demand;
    1.19 +CREATE TABLE transp_demand (
    1.20 +  MARKET TEXT(127),
    1.21 +  DEMAND REAL,
    1.22 +  PRIMARY KEY ( MARKET(127) )
    1.23 +  );
    1.24 +INSERT INTO transp_demand ( MARKET, DEMAND ) VALUES ( 'New York', 325 );
    1.25 +INSERT INTO transp_demand ( MARKET, DEMAND ) VALUES ( 'Chicago', 300 );
    1.26 +INSERT INTO transp_demand ( MARKET, DEMAND ) VALUES ( 'Topeka', 275 );
    1.27 +# distance
    1.28 +DROP TABLE transp_dist;
    1.29 +CREATE TABLE transp_dist (
    1.30 +  LOC1 TEXT(127),
    1.31 +  LOC2 TEXT(127),
    1.32 +  DIST REAL,
    1.33 +  PRIMARY KEY ( LOC1(127), LOC2(127) )
    1.34 +  );
    1.35 +INSERT INTO transp_dist ( LOC1, LOC2, DIST ) VALUES ( 'Seattle',   'New York', 2.5 );
    1.36 +INSERT INTO transp_dist ( LOC1, LOC2, DIST ) VALUES ( 'Seattle',   'Chicago', 1.7 );
    1.37 +INSERT INTO transp_dist ( LOC1, LOC2, DIST ) VALUES ( 'Seattle',   'Topeka', 1.8 );
    1.38 +INSERT INTO transp_dist ( LOC1, LOC2, DIST ) VALUES ( 'San Diego', 'New York', 2.5 );
    1.39 +INSERT INTO transp_dist ( LOC1, LOC2, DIST ) VALUES ( 'San Diego', 'Chicago', 1.8 );
    1.40 +INSERT INTO transp_dist ( LOC1, LOC2, DIST ) VALUES ( 'San Diego', 'Topeka', 1.4 );
    1.41 +# result
    1.42 +DROP TABLE transp_result;
    1.43 +CREATE TABLE transp_result (
    1.44 +  LOC1     TEXT(127),
    1.45 +  LOC2     TEXT(127),
    1.46 +  QUANTITY REAL,
    1.47 +  PRIMARY KEY ( LOC1(127), LOC2(127) )
    1.48 +  );