SenatorSID Name Year Service Party CID1 Jerry 5 Rep 22 Mary 2 Dem 33 Barry 12 Dem 1CountyCID Name Democrats Republicans1 Evergreen 75,000 70,0002 Marsh 12,000 25,0003 Hilltop 9,500 8,000A) List each county in alphabetical order with the senator that serves the county

Questions by gurudevi   answers by gurudevi

Showing Answers 1 - 6 of 6 Answers

Try this,

SELECT  c.name county,  s.name senator

FROM county c, senator s

WHERE s.cid = c.cid

ORDERY BY county;
 
Result;


COUNTY               SENATOR
-------------------- --------------------
Evergreen               Barry
Hilltop                    Marry
Marsh                    Jerry

  Was this answer useful?  Yes

anugrah17

  • Jan 9th, 2008
 

above solution is also correct, but a join is always better :)
--------------------------------------------------------------------------

SELECT     Country.Name AS Country, Senator.Name AS Senator
FROM         Country INNER JOIN
                      Senator ON Country.CID = Senator.CID
ORDER BY Country.Name

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions