create table user_list
(
user_name varchar2(23),
user_age int
);
desc user_list;
alter table user_list
add (userno int );
alter table user_list
modify ( user_name varchar2(50));
alter table user_list
drop column user_age;
insert into user_list(user_name ,userno) values('gouchao' ,10001);
insert into user_list values('xuyongchao',10003);
insert into user_list values('gouchao' ,S_userno.Nextval);
update user_list
set user_name ='gouli' where user_name ='gouchao';
delete from user_list where userno = 10001;
drop table user_list;
select * from user_list;
select userno from user_list;
select userno ID from user_list;
select user_list.userno from user_list;
select a.userno from user_list a ;
select empno ,ename from emp;
select distinct job from emp;
select * from emp where job='CLERK';
select * from emp where job!='CLERK';
select * from emp where sal > 1600;
select * from emp where sal < 1600;
select * from emp where sal >=1600;
select * from emp where sal <= 1600;
select * from emp where sal in (1600,3000);
select * from emp where sal not in(1600,3000);
select * from emp where sal between 1600 and 3000 ;
select * from emp where job like 'M%';
select * from emp where job like 'M_';
select * from emp where job like 'MANAGE_';
elect * from emp where job not like 'M_';
select * from emp where job not like 'M%';
select * from emp where sal is null;
select * from emp where job is null;
select * from emp where sal is not null;
select * from emp where job is not null;
select * from emp where job ='CLERK' and sal <3000;
elect * from emp where job ='CLERK' or sal <3000;
select * from emp where not job ='CLERK';
select * from emp order by job asc , sal desc;
select empno ,ename ,job ,sal from emp group by job ,empno , ename ,sal having sal <=2000;
where group by
select empno , ename , job , sal from emp where sal <=2000 group by job ,empno ,ename ,sal ;
select ename ,job , mgr+sal from emp;
select ename ,job , mgr-sal from emp;
select ename ,job , mgr*sal from emp;
select ename ,job , mgr/sal from emp;
select empno 编号,job 工作,sal 薪水 from emp ;
select a.empno , a.ename , a.sal , b.deptno , b.dname ,b.loc from emp a , dept b ;
select a.empno , a.ename , a.sal , b.deptno , b.dname ,b.loc from emp a , dept b where a.deptno = b.deptno;
select a.empno , a.ename , a.sal , b.deptno , b.dname ,b.loc from emp a , dept b where a.deptno != b.deptno and a.deptno = 10;
select * from emp where sal <=(select sal from emp where ename = 'SMITH');
select * from emp where sal <(select sal from emp where ename = 'SMITH');
select * from emp where sal >=(select sal from emp where ename = 'SMITH');
select * from emp where sal >(select sal from emp where ename = 'SMITH');
select * from emp where sal IN(select sal from emp where ename = 'WARD');
select * from emp where sal not IN(select sal from emp where ename = 'WARD');
select * from emp where sal > any(select sal from emp where job='MANAGER');
select * from emp where sal = some (select sal from emp where job='MANAGER');
select * from emp where sal > all(select sal from emp where job='MANAGER');