w_SHUI
w_SHUI
全部文章
分类
归档
标签
去牛客网
登录
/
注册
w_SHUI的博客
TA的专栏
22篇文章
0人订阅
牛客网题目
22篇文章
69人学习
全部文章
(共23篇)
题解 | 删除记录(三)增删改操作
来自专栏
Truncate nowcoder_exam_record; 「增删改」是数据操作的核心(DML)一、增(INSERT):插入数据1. 基础写法(指定字段,推荐) -- 插入单条记录(指定字段,避免字段顺序变动出错) INSERT INTO exam_record (uid, exam_id, ...
2026-02-28
0
69
题解 | 删除记录(二) limit
来自专栏
delete from exam_record where timestampdiff(minute, start_time, submit_time) < 5 or submit_time is null order by start_time limit 3; LIMIT是SQL中用于限制...
2026-02-28
0
49
题解 | 删除记录(一)日期差计算
来自专栏
delete from exam_record where timestampdiff(minute,start_time,submit_time) < 5 and score < 60; TIMESTAMPDIFF是MySQL官方支持的日期差计算函数直接用日期相减的写法不符合MySQL...
2026-02-28
0
67
题解 | 插入记录(三)replace into insert into
来自专栏
replace into examination_info values(null,9003,'SQL','hard',90,'2021-01-01 00:00:00'); 关键区别于INSERT INTO假设examination_info表的主键/唯一索引是exam_id:无冲突场景:表中无ex...
2026-02-28
0
47
题解 | 插入记录(一)
来自专栏
insert into exam_record(uid, exam_id, start_time, submit_time, score) values(1001, 9001, '2021-09-01 22:11:12', '2021-09-01 23:01:12', 90),(1002, 9002...
2026-02-28
0
55
题解 | 将两个 SELECT 语句结合起来 union(合并再去重) union all(合并)
select prod_id,quantity from OrderItems a where quantity = 100 union all select prod_id,quantity from OrderItems b where b.prod_id like 'bnbg%' order ...
2026-02-28
0
50
题解 | 返回顾客名称和相关订单号 内连接的两种写法
来自专栏
select cust_name,order_num from Customers a join Orders b on a.cust_id = b.cust_id order by cust_name,order_num; select cust_name,order_num from Cust...
2026-02-28
0
62
题解 | 顾客登录名 拼接(concat、||) 大小写转换upper
来自专栏
select cust_id ,cust_name ,upper(concat(substr(cust_contact,1,2),substr(cust_city,1,3))) user_login from Customers; ||: 天然支持无限连写。 --...
2026-02-26
0
57
题解 | 检索产品名称和描述(一) 模糊匹配
来自专栏
select prod_name,prod_desc from Products where prod_desc like '%toy%';
2026-02-26
0
45
题解 | 检索所有列 select * 和 select 具体列名
来自专栏
select cust_id,cust_name from Customers; 在实际生产开发和面试中,更推荐写第二种:虽然在这道题里两种写法结果一样,但在工程实践中,SELECT * 通常被视为坏习惯。🚀 为什么推荐明确列出列名?1. 性能优化(最重要)SELECT *:数据库需要解析元数据...
2026-02-26
0
38
首页
上一页
1
2
3
下一页
末页