sql语句从两张表中选择数据
发布网友
发布时间:2022-04-14 18:36
我来回答
共1个回答
热心网友
时间:2022-04-14 20:05
drop table a;
drop table b;
purge recyclebin;
create table a (id number,authorid number,title varchar2(10));
create table b (id number,name varchar2(10));
insert into a values(1,1,'book1');
insert into a values(2,1,'book2');
insert into a values(3,2,'book3');
insert into a values(4,3,'book4');
insert into b values(1,'writer1');
insert into b values(2,'writer2');
insert into b values(3,'writer3');
commit;
select * from a;
select * from b;
SELECT A.ID, A.TITLE, B.NAME FROM A, B WHERE A.AUTHORID = B.ID;