EXTRACT()

649 단어 SQL
SELECT
	-- Select the season and max goals scored in a match
	season,
    MAX(home_goal + away_goal) AS max_goals,
    -- Select the overall max goals scored in a match
   (SELECT MAX(home_goal + away_goal) FROM match) AS overall_max_goals,
   -- Select the max number of goals scored in any match in July
   (SELECT MAX(home_goal + away_goal) 
    FROM match
    WHERE id IN (
          SELECT id FROM match WHERE EXTRACT(MONTH FROM date) = 07)) AS july_max_goals
FROM match
GROUP BY season;
  • extract () EXTRACT () 함 수 는 날짜 / 시간의 단독 부분, 예 를 들 어 년, 월, 일, 시간, 분 등 을 되 돌려 주 는 데 사 용 됩 니 다.문법 EXTRACT (unit FROM date)
  • 좋은 웹페이지 즐겨찾기