Home » SQL & PL/SQL » SQL & PL/SQL » SQL Help
SQL Help [message #205812] Mon, 27 November 2006 14:21 Go to next message
Messages: 1
Registered: November 2006
Junior Member
Hello, first time on this forum and i need help with my SQL. Never used SQL before so hope someone out there can help. I have a question in my Uni test which is the following: "Give the name of every performer who was born in Scotland, and for each performer show how many instruments they play."

Musician - m_no, m_name, born, died, born_in, living_in
Place - place_no, place_town, place_country
Concert - concert_no, concert_venue, concert_in, con_date, concert_orgniser
Performance - pfrmnc_no, gave, performed, conducted_by, performed_in
Composition - c_no, comp_date, c_title, c_in
Has_Composed - cmpn_no, cmpr_no
Composer - comp_no, comp_is, comp_type
Band - band_no, band_name, band_home, band_type b_date, band_contact
Plays_in – player, band_id
Performer - perf_no, perf_is, instrument, perf_type

The Code i have so far as follows:

select m_name,count(instrument)
from musician join performer on (m_no = perf_no)
join place on (born_in = place_no)
where place_country = 'Scotland'
group by m_name

Your help will be much appreciated
Re: SQL Help [message #205872 is a reply to message #205812] Tue, 28 November 2006 00:16 Go to previous message
Messages: 7880
Registered: March 2000
Senior Member
Welcome to the forum, and to the world of SQL!

Your code looks good to me, except _maybe_ you're not really counting the instruments, but maybe the perf_types.
Does your query not get what you expect? In what way?

(Tip: if you are about to reply explaining what seems to be wrong, take a look at the sticky. It explains how to post in a way you're much more likely to get results)
Previous Topic: Count and place of occurence of a string
Next Topic: convert 1 row into multiple rows
Goto Forum:

Current Time: Mon Oct 24 22:44:12 CDT 2016

Total time taken to generate the page: 0.10328 seconds