When turning in a homework problem, mark it with the exercise number shown in bold here. These will be the reference numbers I use in reporting back your standing on the homework.
9.4.x1:
Write a function, using Oracle's PL/SQL, named CountyName
, which is passed a county ID as a parameter and returns the county's name as its result value. Your function should use the sos.counties
table. You can ignore the possibility that an invalid ID might be provided. If done correctly, the following query should produce a table of 38 rows, a few of which are shown after the query:
select precinct_name, countyname(county_id) from sos.precincts where legislative_district = '19A'; PRECINCT_NAME COUNTYNAME(COUNTY_ID) ------------------------------------ --------------------- LIME TWP Blue Earth . . . ST PETER W-2 P-2 Nicollet TRAVERSE TOWNSHIP Nicollet WEST NEWTON TOWNSHIP Nicollet
9.6.x1: On one of the MCS Department's lab machines, compile and run the attached ListParties JDBC program. You can either work in a Terminal window following the instructions at the top of that file, or you can use Eclipse according the instructions linked here. As the program stands, it shouldn't produce any output (but also shouldn't produce any error messages). Start by extending it to print one line per candidate for a U.S. office, showing the office title and party abbreviation retrieved from the sos.candidates
table. Once that works, have it produce the same kind of output as the example PL/SQL procedure; that output is shown here:
U.S. President & Vice President: CG, CP, DFL, GP, GR, JP, LIB, R, SL, SWP U.S. Representative District 1: DFL, R U.S. Representative District 2: DFL, R U.S. Representative District 3: DFL, R U.S. Representative District 4: DFL, IP, R U.S. Representative District 5: DFL, R U.S. Representative District 6: DFL, R U.S. Representative District 7: DFL, IP, R U.S. Representative District 8: DFL, R U.S. Senator: DFL, GR, IP, MOP, R
Instructor: Max Hailperin