帮忙写出下面问题的SQL语句

来源:百度知道 编辑:UC知道 时间:2024/05/30 08:39:48
在不知道emp表结构的情况下建立3个和emp表结构完全相同但不包含任何数据的表,表明分别是emp_low, emp_med, emp_high,写出建表语句。然后,用一条语句将emp表中数据按照sal取值的大小分别放入上述3个表中。分割标准如下:
sal<1000  emp_low
1001-sal-2000 emp_med
2000<sal emp_high

CREATE TABLE emp_low
AS SELECT * FROM emp
WHERE sal<=1000 ;

CREATE TABLE emp_med
AS SELECT * FROM emp
WHERE sal>1000 and sal <=2000;

CREATE TABLE emp_high
AS SELECT * FROM emp
WHERE sal>2000;

SQL SERVER
select * into emp_low from emp where 1>2

select * into emp_med from emp where 1>2

select * into emp_high from emp where 1>2

insert into emp_low select * from emp where sal<1000 order by sal DESC

insert into emp_med select * from emp where sal between 1000 and 2000 order by sal DESC

insert into emp_high select * from emp where sal>2000 order by sal DESC
ORACLE 建立表
create emp_low asselect * from emp where 1>2