LeetCode(数据库)- 上月播放的儿童适宜电影

简介: LeetCode(数据库)- 上月播放的儿童适宜电影

题目链接:点击打开链接

题目大意:略。

解题思路:学习下解决方案(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';
目录
相关文章
|
数据库
数据库LeetCode每日练习(三)
数据库LeetCode每日练习(三)
数据库LeetCode每日练习(三)
|
SQL 数据库
数据库LeetCode每日练习(二)
数据库LeetCode每日练习(二)
数据库LeetCode每日练习(二)
|
SQL 数据库
数据库LeetCode每日练习(一)
数据库LeetCode每日练习(一)
数据库LeetCode每日练习(一)
|
数据库
LeetCode(数据库)- Hopper Company Queries II
LeetCode(数据库)- Hopper Company Queries II
99 0
LeetCode(数据库)- Hopper Company Queries II
|
数据库
LeetCode(数据库)- 2142. The Number of Passengers in Each Bus I
LeetCode(数据库)- 2142. The Number of Passengers in Each Bus I
202 0
|
数据库
LeetCode(数据库)- The Number of Seniors and Juniors to Join the Company II
LeetCode(数据库)- The Number of Seniors and Juniors to Join the Company II
117 0
|
数据库
LeetCode(数据库)- Number of Accounts That Did Not Stream
LeetCode(数据库)- Number of Accounts That Did Not Stream
117 0
|
数据库
LeetCode(数据库)- The Airport With the Most Traffic
LeetCode(数据库)- The Airport With the Most Traffic
132 0
|
数据库
LeetCode(数据库)- The Category of Each Member in the Store
LeetCode(数据库)- The Category of Each Member in the Store
119 0
|
数据库
LeetCode(数据库)- 上级经理已离职的公司员工
LeetCode(数据库)- 上级经理已离职的公司员工
132 0
下一篇
DataWorks