没有合适的资源?快使用搜索试试~ 我知道了~
SQL常用的增删改查语句、视屏笔记[定义].pdf
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 169 浏览量
2021-10-12
00:40:37
上传
评论
收藏 106KB PDF 举报
温馨提示
试读
17页
SQL常用的增删改查语句、视屏笔记[定义].pdf
资源推荐
资源详情
资源评论
SQL
SQL
TSQL SQL Server SQL
Server
SQL
1 DDL
DDL create alter drop
2 DML
DML select update delete insert
3 DCL
DCL grant revoke deny
4
1
a bigint int smallint tinyint
b float real
c decimal numeric
d moneysmallmoney
STR(ID);---ID STR(ID)
2 varchar char text nchar nvarchar ntext
char varchar
char
Varchar
char(14), 14
3
1insert
insert SQL DML
1
2
3
The column in table mytable may not be null.
4
INSERT
WRITETEXT
insert into ( 1, 2, , ..) values( 1, 2, , .)
( 1, 2, , ..) values( 1, 2, , .)
INSERT SELECT
:INSERT mytable (first_column,second_column)
SELECT another_first,another_second
FROM anothertable WHERE another_first= Copy Me!
anothertable mytable. anothertable
another_first Copy Me
2update SQL DML, WHERE
UPDATETEXT WHERE
update set 1= 1, 2= 2, ,, ..[where .]
update student set sage=20 where sno= s014----
update student set sage=20,set ssex= where sno= s014
----
3delete SQL DML
SQL SELECT DELECT
WHERE TRUNCATE TABLE
delete from [where .]
delete from student---- student
delete from student where sno = s014---- student 014
delete from student where sno >= s013 -- student
013
4
Create INDEX index_name ON table_name (column_name)
4
select
select
select [ 1, 2, , ..] | from 1, 2
[where ]
[group by ]
[having ]
[order by ]
1 *
select * from student
2
select sno sname sage from student
*
3
A:
select sno as ,sname as from student
select =sno, =sname from student
B:
select sno sname sage ssex from student a
course teacher tno
select cname, tname, from course a , teacher b
where a.tno = b.tno
4distinct
, SELECT
select distinct sno from sc
5order by ( )
order by [desc | asc]
desc:
asc
select *from student order by sname
select *from student order by sname desc
6where
Where ( )
where 1[or | and] [ 2] ,
1
Where 1 <expression> 2 |
(7) top n
TOP n [PERCENT] TOP n n TOP n PERCENT
n
:SELECT TOP 2 * FROM `testtable`
:SELECT TOP 20 PERCENT * FROM `testtable`
1
>: <: >= =< <>: =
23
select *from student where sage>23
2
and: or: not:
Where 1<and | or | not> 2
c002
sSelect *from teacher ,course where teacher.tno = course.tno and sourse.cno >
c002
c002 70
select sname , sage , cno ,score from student a , sc b
where a.sno = b.sno and (cno= c002 or score>70)
not
select *from sc where score not between 70 and 80
3 in
select *from sc where score not in(70,90,80)
select *from course where cno in ( c001, c002, c005)
in
select *from sc where sno
in (select sno from student where sno >= s002 )
4 like
like SQL like
% 0
_:
a
select * from student where sname like %
b
select * from student where sname like ___ ----
like
SQL escape( )
select *from student where sname like %$_% escape $
$ $ like
5 all
6 any
7 between , and
5
maxmincount avgsum
max select max(sage) from student----
min select min(sage) from student-----
count
select count (*)from student
select count (sno)from student
count(*): null
count( ) null
avg select avg(sage) from student-----
sum select sum(sage) from student-----
6group by
Select 1 [, 2, .] from group by 1[, 2, ]
剩余16页未读,继续阅读
资源评论
czq131452007
- 粉丝: 2
- 资源: 12万+
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 封装swagger组件,提供全新UI以及无状态登录接口调用解决方案
- 小龙坎支局2024年4月渠道积分核对数据.xlam
- onlyoffice搭建及与alist使用的view.html
- Quadcopter-UAV-attitude-estimation-linux常用命令大全demo
- Quadcopter-UAV-attitude-estimation-based-on-数据库课程设计
- pbdlib-python-master.zip
- 43904245495352013_base.apk
- 基于springboot+vue + redis的工作流审批系统
- 【qt基础语法及实际案例解析】qt基础语法及实际案例解析
- 结课作业.psd
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功