题霸
九号会弹钢琴啊
这个作者很懒,什么都没留下…
展开
-
niuke题霸 SQL篇
SQL66 牛客每个人最近的登录日期(1):较简单select user_id,max(date) as id from login group by user_id order by user_id窗口函数解法:--第一种select distinct user_id, last_value(date) over(partition by user_id order by date rows between current row and unbounded fo原创 2022-04-18 16:06:30 · 190 阅读 · 0 评论 -
记录遇到的MySQL的错误
1、'Operand should contain 1 column(s)'select avg(salary) as avg_salaryfrom salarieswhere salary not in(select max(salary),min(salary) from salaries where to_date='9999-01-01')and to_date='9999-01-01'错误:子查询中有两原创 2022-04-17 20:07:47 · 394 阅读 · 0 评论 -
niuke 题霸 SQ/L篇
SQL51 查找字符串中逗号出现的次数(好像没有这种函数?)解:把逗号去掉前后的长度差SELECT id,length(string)-length(replace(string,',',''))FROM strings注:length、octet_length、char_length、character_lengthSQL52 获取employees中的first_name,并按照first_name最后两个字母升序进行输出知识点:first_name最后两个字母LEFT(原创 2022-04-17 12:11:41 · 531 阅读 · 0 评论 -
niuke题霸SQ/L篇
SQL33 创建一个actor表,包含如下列信息CREATE TABLE actor( actor_id smallint(5) not null comment'主键id', first_name varchar(45) not null comment'名字', last_name varchar(45) not null comment'姓氏', last_update date not null comment'日期', p原创 2022-04-17 10:58:51 · 365 阅读 · 0 评论