SQL基础学习笔记【Forward】
来源:互联网 发布:linux can总线 编辑:程序博客网 时间:2024/04/29 04:44
数据定义
create
alter
drop
table、view、index、procedure、trigger、schema、domain
数据操作
select
insert
delete
update
数据控制
grant
deny
revoke
事物控制
commit
rollback
set transaction
注明:以下SQL语句中M,N为表 A,B,C为栏目
select distinct A from M where A>100 or (A<50 and A>30)
select * from M where A in ('namea','nameb')
select * from M where A between '1982' and '1992' 取出1982-1992的数据
select * from M where A like 'a_z' 'a%' '%a' '%a%'
select * from M order by A asc, B desc
select sum(A),B from M group by A having sum(A)>100
select count(distinct A),B from M group by B
内部连接
select * from M,N where M.A=N.A
外部连接
where A1.A=A2.A(+)
select concat(A,B) from M 把A,B数据字符串串连起来
select substr(A,3,4) from M 抓出A中第3个字符开始向后抓4个字符
select trim(' sample ')
select ltrim(' sample ')
select rtrim(' sample ')
表格处理
create table M (SID integer Unique,First_name char(50) not null,Last_name char(50),Birth_date date)
create table M (SID integer Unique)
create table M (SID integer Check (SID>0))
create table M (SID integer,Primary Key(SID))
create table M (SID integer Primary Key)
alter table M Add Primary Key (SID)
限制
not null
unique 不允许输入重复值
check
create view 视图名 as select * from M
create index 索引名 on M(A,B)
alter table M add C char(50)
alter table M change A C char(50) 修改栏目A为C
alter table M modify C char(30)
alter table M drop C
drop table M
truncate table M
insert into M (A,B) values ('a','b')
insert into M (A,B) select A,B from N where ……
update M set A=a,B=2 where …… 修改数据
delete from M where ……
select A from M
union/union all/intersect/minus
select A from N
- SQL基础学习笔记【Forward】
- SQL学习基础笔记
- SQL学习笔记-基础学习
- 学习笔记のsendRedirect &forward
- 学习笔记のsendRedirect &forward
- 学习笔记のsendRedirect &forward
- Forward渲染路径学习笔记
- sql操作基础学习笔记
- T-SQL基础 学习笔记
- 学习笔记-SQL基础语法
- SQL学习笔记:基础SQL语句
- sql学习笔记(1)-------------学习基础
- Oracle学习笔记二:SQL*PLUS基础
- Oracle学习笔记五:PL/SQL基础
- pl/sql学习笔记之一 语言基础
- PL/SQL学习笔记[1]-基础
- SQL零基础学习笔记(一)
- Oracle基础学习笔记(五) (PL/SQL)
- 查询时出错 An expected Field was not found or could not be retrieved properly. [SHAPE.AREA] 解决方法
- 归并排序
- Hibernate的merge()方法
- 【安卓错误】 AndroidManifest.xml file missing!
- 书籍
- SQL基础学习笔记【Forward】
- 显示MYSQL表信息的方法
- vs2010 LINK : fatal error LNK1149: 输出文件名匹配输入文件名“D:\UNice最新版本for微信\lib\VC90\Release\Export.lib”
- Centos 6.2 配置php-cgi错误
- linux驱动开发之旅--余下剩余的(二)(三)(四)(五)(六)(七)
- iframe的下拉菜单
- Mysql创建函数出错的解决
- ArcGIS 10.2.1 for Desktop新特性
- bash下查看二进制文件后界面乱码的处理