22 January 2018

soccerPlayers

My solution:
CREATE PROCEDURE soccerPlayers() 
BEGIN 
  SELECT GROUP_CONCAT(first_name, ' ', surname, ' #', player_number ORDER BY 
         player_number ASC 
         SEPARATOR '; ') AS players 
  FROM   soccer_team; 
END 

movieDirectors

My solution:
CREATE PROCEDURE movieDirectors() 
BEGIN 
  SELECT director 
  FROM   (SELECT director, 
                 SUM(oscars) AS n_oscars 
          FROM   moviesInfo 
          WHERE  year > 2000 
                 AND oscars > 0 
          GROUP  BY director) x 
  WHERE  x.n_oscars > 2; 
END 

travelDiary

My solution:
CREATE PROCEDURE travelDiary() 
BEGIN 
  SELECT GROUP_CONCAT(DISTINCT country ORDER BY country ASC SEPARATOR ';') AS 
         countries 
  FROM   diary; 
END