...用自己姓名查询工资是多小怎么写一个SQL语句?
发布网友
发布时间:2024-10-24 13:25
我来回答
共2个回答
热心网友
时间:2024-10-29 10:32
--创建a表
create table a(
id number,
encode varchar(30),
name varchar(20)
);
--创建b表
create table b(
name varchar(20),
deptno number,
sal number
);
--创建a表的序列
create sequence seq_a
start with 1
maxvalue 999
insert into a values(seq_a.nextval,'123','zhangsan');
insert into a values(seq_a.nextval,'123','lisi');
insert into a values(seq_a.nextval,'123','wangwu');
insert into b values('zhangsan',10,9000);
insert into b values('lisi',20,9000);
select t.* from
(select a.name,b.sal from a inner join b on a.name = b.name) t
where t.name = 'zhangsan'
望采纳!
热心网友
时间:2024-10-29 10:33
select 工资 from b
where 姓名 ='张三'