LeetCode--620.有趣的电影

某城市开了一家新的电影院,吸引了很多人过来看电影。该电影院特别注意用户体验,专门有个 LED显示板做电影推荐,上面公布着影评和相关电影描述。

作为该电影院的信息部主管,您需要编写一个 SQL查询,找出所有影片描述为 boring(不无聊)的并且id 为奇数的影片,结果请按等级rating排列。

在这里插入图片描述

-- ----------------------------
-- Table structure for `cinema`
-- ----------------------------
DROP TABLE IF EXISTS `cinema`;
CREATE TABLE `cinema` (
  `id`int(11) NOT NULL,
  `movie`varchar(255) DEFAULT NULL,
 `description` varchar(255) DEFAULT NULL,
 `rating` float(2,1) DEFAULT NULL,
  PRIMARYKEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of cinema
-- ----------------------------
INSERT INTO `cinema` VALUES ('1', 'War', 'great3D', '8.9');
INSERT INTO `cinema` VALUES ('2', 'Science','fiction', '8.5');
INSERT INTO `cinema` VALUES ('3', 'irish','boring', '6.2');
INSERT INTO `cinema` VALUES ('4', 'Ice song','Fantacy', '8.6');
INSERT INTO `cinema` VALUES ('5', 'House card','Interesting', '9.1');
select * from cinema where description <> 'boring' and  MOD(id, 2) = 1 
order by rating desc;

猜你喜欢

转载自blog.csdn.net/qq_42363032/article/details/108909821