acari: painting | red butterfly on blue background with swirly ornaments (Default)
Fran ([personal profile] acari) wrote in [personal profile] amalthia 2010-11-05 10:15 am (UTC)

Have you tried simply drawing your tables on a piece of paper? It always helps me when I'm having trouble visualising things in my head. The SQL book we used in class worked very well for me, but it only exits in German so it wouldn't be any help to you.

In your query you forgot to assign alias-names to the fields to connect them to a specific table.

SELECT city.CITY_NAME, team.TEAM_NAME, coach.COA_FNAME, coach.COA_LNAME
FROM CITY, TEAM, COACH
WHERE CITY.CITY_CODE=TEAM.CITY_CODE
AND TEAM.TEAM_NUM=COACH.TEAM_NUM
AND city.CITY_NAME='JAMESVILLE';

or

SELECT c.CITY_NAME, t.TEAM_NAME, co.COA_FNAME, co.COA_LNAME
FROM CITY c, TEAM t, COACH co
WHERE c.CITY_CODE=t.CITY_CODE
AND t.TEAM_NUM=co.TEAM_NUM
AND c.CITY_NAME='JAMESVILLE';

Post a comment in response:

This account has disabled anonymous posting.
(will be screened if not validated)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org