Professional Documents
Culture Documents
2022-11-10 Assignments SQL Queries Solutionms
2022-11-10 Assignments SQL Queries Solutionms
SportsClub:
1. Return all male minors of the sportsClub that have a parent in the club and are not yet adult (<18
year old).
SELECT * FROM `memtra` WHERE `gender`="m" AND `isChildFK`IS NOT NULL AND `age`<18 and
isMember=1;
4. How old is the oldest and how old is the youngest member – return the ages of the oldest and
youngest member.
SELECT min(`age`) as "Youngest Member", max(`age`) as "Oldest Member" FROM `memtra`;
5. Return name, age and parent name of the youngest Club Member
SELECT `memName` as 'Name of youngest member',`isChildOf` as 'Parent of youngest member',
`age`
FROM `memtra`
WHERE `age` =
(select min(`age`) from memtra)
6. Return for each course the number of member enrollments that the course has. (How many
participants does each course have)
select `courseID`, count(*) as 'Number of participants'
from enrollment group by `courseID` order by count(*) desc;