高级资深攻城狮
高级资深攻城狮
全部文章
分类
题解(90)
归档
标签
去牛客网
登录
/
注册
高级资深攻城狮的博客
全部文章
(共82篇)
题解 | #对于employees表中,给出奇数行的first_name#
方法二是自己写的,不知道怎么就过了。。,为什么方法二用in就不行,方法一是借鉴网友的: 方法一: SELECT e1.first_name FROMemployees e1WHERE(SELECT count(*) FROM employees e2WHERE e1.first_name <=...
Mysql
2021-09-28
0
254
题解 | #统计salary的累计和running_total#
探索了两种写法,第二种使用了窗口函数select emp_no,max(salary),(select sum(s2.salary) from salaries s2 where s2.emp_no<=s1.emp_no and s2.to_date='9999-01-01') from sa...
Mysql
2021-09-28
0
243
题解 | #获取有奖金的员工相关信息。#
总结了两种写法:一种用case when then end,另一种用if(condition,true,false)方法一:select e.emp_no,first_name,last_name,btype,salary,(0.1salary(if(btype>2,3,btype)))fro...
Mysql
2021-09-28
0
305
题解 | #平均工资#
select * from employeeswhere not exists ( select emp_no from dept_emp where emp_no = employees.emp_no);需要将所查询的表和子表关联,不然查不出数据。
Mysql
2021-09-28
0
252
题解 | #平均工资#
select (sum(salary)-max_min.max_s-max_min.min_s)/(count()-2)from salaries,( select max(salary) as max_s,min(salary)as min_s from salaries where...
Mysql
2021-09-28
0
264
题解 | #将所有to_date为9999-01-01的全部更新为NULL#
select first_name from employees order by substring(first_name,-2) select first_name from employees order by substr(first_name,-2 ) select first_name ...
Sqlite
2021-09-28
0
264
题解 | #将所有to_date为9999-01-01的全部更新为NULL#
Mysql: select concat(employees.last_name,"'",employees.first_name) from employeesSqllite: select employees.last_name||"'"||e...
Sqlite
2021-09-27
0
382
题解 | #将所有to_date为9999-01-01的全部更新为NULL#
update salaries set salaries.salary = salaries.salary*(1.1)where salaries.to_date='9999-01-01' and salaries.emp_no in(select emp_no from emp_bonus)使用...
Sqlite
2021-09-27
0
236
题解 | #将所有to_date为9999-01-01的全部更新为NULL#
alter table audit add constraint foreign key (emp_no) references employees_test(id)添加外键方法,alter table “table_name” add constraint foreign key(“table_n...
Sqlite
2021-09-27
0
295
题解 | #将所有to_date为9999-01-01的全部更新为NULL#
update titles_test set emp_no=replace(emp_no,10001,10005) where id=5 and emp_no=10001replace(column_name,x,y)函数用法,将column_name由想,替换成y使用update结合replace...
Sqlite
2021-09-27
0
343
首页
上一页
1
2
3
4
5
6
7
8
9
下一页
末页