0% found this document useful (0 votes)
100 views3 pages

Gregslist SQL

This document contains SQL code to create a database table called t_gregslist to store profile information for users of an online classifieds site called Greg's List. It includes fields for basic contact information as well as interests, profession, status etc. The code then inserts 20 sample records into the table and sources SQL files to create lookup tables for profession, zipcode, status etc. It outlines next steps to link the records to the lookup tables.

Uploaded by

xfelix1987
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
100 views3 pages

Gregslist SQL

This document contains SQL code to create a database table called t_gregslist to store profile information for users of an online classifieds site called Greg's List. It includes fields for basic contact information as well as interests, profession, status etc. The code then inserts 20 sample records into the table and sources SQL files to create lookup tables for profession, zipcode, status etc. It outlines next steps to link the records to the lookup tables.

Uploaded by

xfelix1987
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

-- ---------------------------------------------------------------------------------------- gregslist.

sql
--- See gregslist.doc.
-- --------------------------------------------------------------------------------------source c:/Users/russ/dev/sql/delete.sql
CREATE TABLE t_gregslist
(
id
INTEGER AUTO_INCREMENT NOT NULL PRIMARY
KEY,
last_name
VARCHAR(32),
first_name
VARCHAR(32),
email
VARCHAR(64),
gender
CHAR(1),
birthday
DATE,
profession
VARCHAR(64),
location
VARCHAR(64),
zipcode
VARCHAR(5),
status
VARCHAR(32),
interests
VARCHAR(128),
seeking
VARCHAR(64),
prof_id
INTEGER,
zipcode_id
INTEGER,
status_id
INTEGER
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- As soon as we create some of the other tables, we'll go in and drop zipcode,
status, interests, profession and seeking.
-- We'll create the big table with all the fields, then move some of these field
s out
-- into the other tables...
INSERT INTO t_gregslist ( last_name, first_name, email, gender, birthday, profes
sion, location, zipcode, status, interests, seeking )
VALUES ('Anderson','Jillian','[email protected]','F','198
0-09-05','Technical Writer','Palo Alto, CA','94304','single','kayaking, reptiles
','relationship, friends');
INSERT INTO t_gregslist ( last_name, first_name, email, gender, birthday, profes
sion, location, zipcode, status, interests, seeking )
VALUES ('Kenton','Leo','[email protected]','M','1974-01-10','Ma
nager','San Francisco, CA','94118','divorced','women','women to date');
INSERT INTO t_gregslist ( last_name, first_name, email, gender, birthday, profes
sion, location, zipcode, status, interests, seeking )
VALUES ('McGavin','Darrin', '[email protected]','M','1966
-01-23','Cruise Ship Captain','San Diego, CA','92103','single','sailing, fishing
, yachting','women for casual relationships');
INSERT INTO t_gregslist ( last_name, first_name, email, gender, birthday, profes
sion, location, zipcode, status, interests, seeking )
VALUES ('Franklin','Joe','[email protected]','M','1977-04-28'
,'Software Sales','Dallas, TX','75204','married','fishing, drinking','new job');
INSERT INTO t_gregslist ( last_name, first_name, email, gender, birthday, profes
sion, location, zipcode, status, interests, seeking )
VALUES ('Hamilton','Jamie','[email protected]','F','1964-0910','System Administrator','Princeton, NJ','08540','married','RPG','nothing');
INSERT INTO t_gregslist ( last_name, first_name, email, gender, birthday, profes
sion, location, zipcode, status, interests, seeking )

VALUES ('Chevrolet','Maurice','[email protected]','M','1962-07-0
1','Bookshop Owner','Mountain View, CA','94041','married','collecting books, scu
ba diving','friends');
INSERT INTO t_gregslist ( last_name, first_name, email, gender, birthday, profes
sion, location, zipcode, status, interests, seeking )
VALUES ('Kroger','Renee','[email protected]','F','1976-12-03',
'Unemployed','San Francisco, CA','94118','divorced','cooking','employment');
INSERT INTO t_gregslist ( last_name, first_name, email, gender, birthday, profes
sion, location, zipcode, status, interests, seeking )
VALUES ('Mendoza','Angelina','[email protected]','F','1979-0819','UNIX Sysadmin','San Francisco, CA','94118','married','acting, dancing','new
job');
INSERT INTO t_gregslist ( last_name, first_name, email, gender, birthday, profes
sion, location, zipcode, status, interests, seeking )
VALUES ('Murphy','Donald','[email protected]','M','1967-01-23',
'Computer Programmer','New York City, NY','10007', 'committed relationship','RPG
, anime','friends');
INSERT INTO t_gregslist ( last_name, first_name, email, gender, birthday, profes
sion, location, zipcode, status, interests, seeking )
VALUES ('Spatner','John','[email protected]','M','1963-04-18','Sales
man','Woodstock, NY','12498','married','poetry, screenwriting','nothing');
INSERT INTO t_gregslist ( last_name, first_name, email, gender, birthday, profes
sion, location, zipcode )
VALUES ('Toth','Anne','[email protected]','F','1969-11-18', 'Art
ist','San Francisco, CA','94118');
INSERT INTO t_gregslist ( last_name, first_name, email, gender, birthday, profes
sion, location, zipcode )
VALUES ('Manson','Anne','[email protected]','F','1977-08-09', 'Baker'
,'Seattle, WA', '98102');
INSERT INTO t_gregslist ( last_name, first_name, email, gender, birthday, profes
sion, location, zipcode )
VALUES ('Hardy','Anne','[email protected]','F','1963-04-18', 'Teacher'
,'San Francisco, CA','94118');
INSERT INTO t_gregslist ( last_name, first_name, email, gender, birthday, profes
sion, location, zipcode )
VALUES ('Parker','Anne','[email protected]','F','1983-01-10', 'St
udent','San Francisco, CA','94118');
INSERT INTO t_gregslist ( last_name, first_name, email, gender, birthday, profes
sion, location, zipcode )
VALUES ('Blunt','Anne','[email protected]','F','1959-10-09',
'Web Designer','San Francisco, CA','94118');
INSERT INTO t_gregslist ( last_name, first_name, email, gender, birthday, profes
sion, location, zipcode )
VALUES ('Jacobs','Anne','[email protected]','F','1968-02-05', 'Comp
uter Programmer','San Jose, CA', '95118');
INSERT INTO t_gregslist ( last_name, first_name, email, gender, birthday, profe
ssion, location, zipcode, status, interests, seeking )
VALUES ( 'Everett', 'Joan', '[email protected]', 'F', '1978-0403', 'Artist', 'Salt Lake City UT', '84111', 'single', 'sailing, hiking, cooking
', 'single man' );
INSERT INTO t_gregslist ( last_name, first_name, email, gender, birthday, profe
ssion, location, zipcode, status, interests, seeking )
VALUES ( 'Singh', 'Paul', '[email protected]', 'M', '1980-12-10', 'P
rofessor', 'New York, NY', '10007', 'single', 'dogs, spelunking', 'single woman'
);
INSERT INTO t_gregslist ( last_name, first_name, email, gender, birthday, profe
ssion, location, zipcode, status, interests, seeking )
VALUES ( 'Baldwin', 'Tara', '[email protected]', 'F', '1970-09-01'
, 'Chef', 'Boston, MA', '02111', 'single', 'movies, reading, cooking', 'single m
an' );

SELECT id, last_name, first_name, gender, birthday, profession, location, zipcod


e, status, interests, seeking, prof_id, zipcode_id, status_id FROM t_gregslist;
source
source
source
source
source

c:/Users/russ/dev/sql/profession.sql
c:/Users/russ/dev/sql/zipcode.sql
c:/Users/russ/dev/sql/status.sql
c:/Users/russ/dev/sql/interest.sql
c:/Users/russ/dev/sql/seeking.sql

-- Fix-up is mostly done via Java code:


-- Walk t_gregslist and link each row up to t_profession...
-- Walk t_gregslist and link each row up to t_zip_code...
-- Walk t_gregslist and link each row up to t_status...
-- Walk t_gregslist and set up a row in t_contract_interest to point into a t_g
regslist row...
-- Walk contact_interest rows and point them to rows in t_interests...
-- Walk t_gregslist and set up a row in t_contract_seeking to point into a t_gr
egslist row...
-- Walk contact_seeking rows and point them to rows in t_seeking...
source c:/Users/russ/dev/sql/create-other.sql
SELECT * from t_gregslist;

You might also like