FANLE

vuePress-theme-reco FANLE    2019 - 2021
FANLE FANLE

Choose mode

  • dark
  • auto
  • light
主页
分类
  • 瞎扯
  • 后端
  • 数据库
  • 考试
  • 前端
  • 心情
标签
时间线
GitHub
author-avatar

FANLE

49

Article

24

Tag

主页
分类
  • 瞎扯
  • 后端
  • 数据库
  • 考试
  • 前端
  • 心情
标签
时间线
GitHub
  • 常用的sql 查询记录

常用的sql 查询记录

vuePress-theme-reco FANLE    2019 - 2021

常用的sql 查询记录


FANLE 2020-06-10 SQL

这里记录下常用的 sql 查询语句, 方便必要时使用

增加


INSERT INTO 表名称 VALUES (值1, 值2,....)

INSERT INTO table_name (列1, 列2,...) VALUES (值1, 值2,....)

1
2
3
4
5

删除


delete from t1 where xxx = 'xxx'

1
2
3

修改


update 数据表 set 字段 bai名=字段值 where 条件表 du达式


1
2
3
4

查找


select * from t1;


-- 条件查询
select * from t1 where xxxx='xxx';



-- 模糊查询
select * from Pump p 

LEFT JOIN Users u

on p.SysHospital_ID = u.SysHospital_ID 

where 

	u.SysHospital_ID = '666666'

	and
	
	u.SysProduct_ID like '%3%'
	
	and 
	
	p.SysProduct_ID = '3'
	
	and
	
	u.UserCode = 'floor1'

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

清空表


truncate table [表名]

1
2
3

利用分组查询不重复的数据

select FollowUp from table where FollowUp IS NOT NULL order by max(BillDate) desc;
1