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
?
總結
以上是生活随笔為你收集整理的SQL语句:建表语句、插入语句、查询语句、增加列、删除列、查询语句like、修改语句的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: NYOJ--927--dfs--The
- 下一篇: linux cmake编译源码,linu