oracle 语句

Oracle简单语法

一、创表

Create Table depttest22

  (Id Varchar2(100),

  Name Varchar2(100),

  Phone Varchar2(100),

  photo Varchar2(100),

  address Varchar2(100),

  sex Varchar2(100),

  salary Varchar2(100)

  )

二、增加(插入内容)

Insert Into depttest22 Values('4','tom3','18852851373','123125','江苏','女','7000');

三、删除

1.删除内容

delete from depttest1 where deptid='d006';(没有*号)

2.删除表

DROP TABLE depttest ;(永久删除数据表)

四、查询

1.查询

Select * From grxx;(全查询)

Select Distinct * From depttest1;(不重复查询)

select * from grxx where salary like '%00%';(模糊查询)

select * from grxx where salary between 2000 and 3000;(范围查询)

2.排序

select * from grxx where salary like '%00%' order by no asc;(默认:低-->高)

select * from grxx where salary like '%00%' order by no desc;(高-->低)

select top 2 * from grxx where salary like '%00%' order by no desc;(最前2条数据)

3.关联

select * from grxx,depttest1 where grxx.dept=depttest1.deptid;

    select * from grxx inner join depttest1 on grxx.dept=depttest1.deptid;

4.别名

with emp as (select * from grxx)

 

五、修改

update grxx set name='TOM1' where no='1';

posted @ 2018-02-02 15:04  mishalyin  阅读(154)  评论(0编辑  收藏  举报