2021.02.22

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

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

Create table If Not Exists cinema (id int, movie varchar(255), description varchar(255), rating float(2, 1))
Truncate table cinema
insert into cinema (id, movie, description, rating) values ('1', 'War', 'great 3D', '8.9')
insert into cinema (id, movie, description, rating) values ('2', 'Science', 'fiction', '8.5')
insert into cinema (id, movie, description, rating) values ('3', 'irish', 'boring', '6.2')
insert into cinema (id, movie, description, rating) values ('4', 'Ice song', 'Fantacy', '8.6')
insert into cinema (id, movie, description, rating) values ('5', 'House card', 'Interesting', '9.1')

解题要点:
1.不等于表示 :

description<> boring;   description!=boring;

2.奇数的表示方法:

mod(x, 2) = 1 ,如果余数是 1 就是奇数。
power(-1, x) = -1 , 如果结果是 -1 就是奇数
x % 2 = 1 ,如果余数是 1 就是奇数。
x & 1 = 1 ,如果是 1 就是奇数
x regexp '[1, 3, 5, 7, 9]$' = 1 如果为 1 就是奇数
x>>1<<1 != x 如果右移一位在左移一位不等于原值,就是奇数

2.字符串分割成字符串数组

pattern = "abba", str = "dog cat cat dog"
pattern=pattern.split('')//空字符串会分割每一个字母['a','b','b','a']
str=str.split(" ");//空格会分割每一个单词["dog","cat","cat","dog"]

3.字符串截取

str.substring(index);

4.在页面上发送的code会通过转码,变成JSON对象,request里的是JSON对象,所以要用req.query.code读取,只有Express中connection.query()的result要JSON.stringify()成字符串后再resolve出去。
5.data:固定的写法

methods: {
    async sorry() {
      let code = this.id;//v-model="id"
      let result = await HttpUtilBase.tryDoGet(
        "/api/helloWorld?code=" + code,
        1000,
        3
      );
      this.stocks = result.data;//data:固定的写法
    },
  },

6.axios响应

public static async tryDoGet(url: string, timeoutMilli: number, maxRetryTimesLeft: number) {
json.response = await axios({
                method: "get",
                url: url,
                timeout: timeoutMilli,
                cancelToken: source.token
            });
  return json.response;
  }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值