欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

自己练习建表 有大用

create table students(

id int primary key ,

name varchar(12)


);


insert into students(id,name)values(1,'aaa');

insert into students(id,name)values(2,'bbb');

insert into students(id,name)values(3,'ccc');


select * from students;


insert into students2(id,name)values(1,'aaa');

insert into students2(id,name)values(2,'bbb');

insert into students2(id,name)values(3,'ccc');

insert into students2(id,name)values(4,'ddd');



select * from students intersect select * from students2;

select * from students minus select * from students2  #前表减后表


alter table students add constraint id_pk primary key(id);


CREATE TABLE STUDENTS2 AS SELECT * FROM STUDENTS;



create table courses 

(

id int,

name varchar(20),

s_id int


)



insert into students(id,name)values(20,'kkk');



select * from students s,courses c where s.id=c.s_id(+);  #加号在右边相当于左外连接



select * from students where rownum=1 or rownum=2;


普通分类: