1、创建表
create table s(
id number(100),
name varchar2(100),
.........
)
2、增
insert into s(id,name) values (seq.Nextval,'ss') //id为序列
3、删
delete from s where id = 1
4、改
update s set name = 'a' where id = 1
5、查
select * from s where id = 1
6、修改字段
alter table s modify name varchar2(200)
7、内连接
select * from u inner join s on u.id = s.id
8、左外连接
select * from u left join s on u.id = s.id
9、去重
select distinct name from s where id = 1
10、排序
select * from s order by time desc //desc从大到小,asc从小到大
11、oracle分页
select * from (select rownum as rn,* from s where rownum<=5) where rn >=10
12、mysql分页
select * from s limit 0,2 //从0+1个数据开始,取2个
13、分组
select name,max(age) as amax from s where id > 10 group by name having amax > 25
14、聚合函数
sum、max、min、count、avg
java面试(一):数据库基础
最新推荐文章于 2024-05-03 20:00:48 发布