Oracle SQL

来源:百度知道 编辑:UC知道 时间:2024/06/05 10:23:03
据说很简单,但咱没学过,所以高分求人做下。
create table t_tmp
p_c_empid varchar2(20) primary key,
c_name varchar2(20),
c_sex varchar2(10),
c_deptno varchar2(20),
c_eduid varchar2(20),
f_sal number(8,2),

1.为表t_emp 添加一个字段,字段的名称:c_address,类型是varchar2(50);

2.为表t_emp添加注释,注释为“职工表”,为表的字段c_name添加注释,注释为“职工姓名”

3.为表t_emp的c_name字段添加非空约束

4.如果表有数据,请你查询出部门编号为“002”,名字姓李的女职工;

5.请创建序列,名称为 seq_Emp 参数描述从150开始计数,每次增长3;

6.创建一个视图,名称为“v_emp”,如果查询该视图,可以查询出工资比平均工资高的所有女职工。

7.编写一个匿名块,功能描述:如果t_emp表的职工人数超过了1000人,请您插入一条记录,职工编号使用序列seq_emp。数据自定。
邮箱:lw7221896@163.com

1、alter table add(c_address varchar2(50));
2、---说实话不了解

3、
a)alter table t_emp modify c_name varchar2(20) not null;
b)alter table add constraint t_emp add check(c_name <> '');

4、select * from t_tmp where c_deptno='002' and c_sex='女' and c_name like '李%';

5、create sequence seq_Emp
increment by 3
start with 150
nomaxvalue
nocycle
cache;

6、create or replace view v_emp as
select f_sal from t_tmp
where f_sal>(select avg(f_sal) 平均工资 as from t_tmp) and c_sex='女';

7、--说实话不了解

----
以上希望对你能有帮助。