-- -- Show me all Questions and Answers -- select qid, question, av_v.avalue from av_v JOIN questions USING (qid); -- -- of all addressed entered for any question, -- how many are in zipcode 94609? -- select question, addr, city, zip from questions JOIN answer_addr USING (qid) where zip = '94609'; -- -- What questions used a date range? -- select qid, question from questions where atype = 'date' and ncols = 2; -- -- What are the date ranges for question 3? -- (sorry not a lot of test data here :) -- select qid, question, avalue from qna where qid = 3; select qid, question, astart, aend from questions q JOIN answer_date_2 using (qid); -- -- Who answered a start date after 4/1/05 for question 3 -- select orid, orname, qid, question, astart, aend from questions q JOIN answer_date_2 using (qid) JOIN answerers using (orid) where astart > '4/1/05' and qid = 3; -- -- what was the average amount of start and end for question 5? -- select avg(astart), avg(aend) from questions JOIN answer_numeric_2 using (qid) where qid = 5;