0

I'm studying for an exame on database systems and SQL, and I'm having a problem with an exercise my teacher gave me. Given this physical ERD: physical diagram

I am asked to:

In a SINGLE QUERY, get the name of the players which are associated with teams that compete in either "Competition A" or "Competition B". Include the names of players associated with the team "Team X" and the names of players in teams that were founded in the 40s (1940 trough 1949).

The first part of the question isn't really the problem, but when I get to "Include the names...", it gets tricky.

Any help would be appreciated :) Thank you very much!

  • 1
    `SELECT ... UNION SELECT ...` – Ulrich Thomas Gabor Jan 15 '20 at 23:45
  • Please [use text, not images/links, for text--including tables & ERDs](https://meta.stackoverflow.com/q/285551/3404097). Paraphrase or quote from other text. Give just what you need & relate it to your problem. Use images only for what cannot be expressed as text or to augment text. Images cannot be searched for or cut & pasted. Include a legend/key & explanation with an image. – philipxy Jan 16 '20 at 00:24
  • Please show parts you can do. See [ask], hits googling 'stackexchange homework' & the voting arrow mouseover texts. Please in code questions give a [mre]--cut & paste & runnable code; example input (as initialization code) with desired & actual output (including verbatim error messages); tags & versions; clear specification & explanation. For errors that includes the least code you can give that is code that you show is OK extended by code that you show is not OK. (Debugging fundamental.) For SQL that includes DBMS & DDL, which includes constraints & indexes & tabular initialization. – philipxy Jan 16 '20 at 00:26
  • [Is there any rule of thumb to construct SQL query from a human-readable description?](https://stackoverflow.com/a/33952141/3404097) – philipxy Jan 16 '20 at 00:29

1 Answers1

-1

I'm not sure if I understand your question, you want to get Competition's A and B players plus players of team X ? You can use Union with 2 select

  • 1
    This should be a comment not an answer, so wait until you have the reputation. Also guessing at answers of unclear posts makes a mess. – philipxy Jan 16 '20 at 00:28