2000字范文,分享全网优秀范文,学习好帮手!
2000字范文 > SQL语句:建表语句 插入语句 查询语句 增加列 删除列 查询语句like 修改语句

SQL语句:建表语句 插入语句 查询语句 增加列 删除列 查询语句like 修改语句

时间:2019-04-14 10:51:51

相关推荐

SQL语句:建表语句 插入语句 查询语句 增加列 删除列 查询语句like 修改语句

1、建表

create table student (

id number(10,0) not null,

uname varchar2(255 char),

pword varchar2(255 char),

primary key (id)

);

2、插入

insert into student values(1,'张三','qweerwe');

insert into student values(2,'李四','asdff');

insert into student values(4,'王五7','ry123');

insert into USERINFODZ(USERNAME,USERPWD,age) values('Z自己56','322',56);

3、查询

全部查询

select * from student;

条件查询

(select * from USERINFODZ where age>15)

4、增加列、删除列

alter table USERINFODZ add agee number(10,0)

alter table USERINFODZ drop column agee

5、查询 like语句

select * from USERINFODZ where username LIKE '%围%'

只有包含“围”

select * from USERINFODZ where username LIKE '围%'

开头是“围”

select * from USERINFODZ where username LIKE '%围'

结束是“围”

6、修改语句

update student set uname='萨拉赫' where uname = '内马尔'

附:

总数:select count * as totalcount from table1

oracle查询总数:select count(*) from student;

求和:select sum(field1) as sumvalue from table1

平均:select avg(field1) as avgvalue from table1

最大:select max(field1) as maxvalue from table1

最小:select min(field1) as minvalue from table1

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。