You are on page 1of 1

drop table student;

drop table teacher;


drop sequence std_id;
drop index teaindex;
create table student(stdid number(3), ename varchar(25), constraint stdid_pk pri
mary key(stdid));
create table teacher(teaid number(3), tname varchar(25), constraint tid_pk prima
ry key(teaid));
alter table student add(teaid number(3),constraint tid_fk foreign key(teaid) ref
erences teacher(teaid));
insert into teacher values(100,'Humaira');
insert into teacher values(200,'Younas');
insert into teacher values(300,'Bano');
insert into teacher values(400,'Shahid');
insert into student values(10,'Phool',100);
insert into student values(20,'Mashal',100);
insert into student values(30,'Asma',200);
insert into student values(40,'Zarnigar',200);
create index teaindex on teacher(tname);
create sequence std_id increment by 10 start with 50 maxvalue 100 nocache nocycl
e;
insert into student values(std_id.nextval,'Ayeshe',300);
select * from student;
select * from teacher;
select std_id.currval from dual;
select index_name from user_indexes;

You might also like