题目链接:点击打开链接
题目大意:略。
解题思路:学习下解决方案(2)中的 YEAR 函数和 MONTH 函数。
AC 代码
-- 解决方案(1) SELECT DISTINCT title FROM TVProgram tv JOIN Content c ON tv.content_id = c.content_id AND content_type = 'Movies' AND Kids_content = 'Y' AND DATE_FORMAT(program_date, '%Y-%m') = '2020-06' -- 解决方案(2) SELECT DISTINCT c.title FROM TVProgram AS t INNER JOIN Content AS c ON t.content_id = c. content_id WHERE YEAR(t.program_date) = 2020 AND MONTH(t.program_date) = 6 AND c.content_type = 'Movies' AND c.Kids_content = 'Y';