Creating and Describe Table:
SQL> create table student20903(Rollno number(5) primary key,Fname char(10),Lname char(10),adds varchar2(25),DOB date);
Table created.
SQL> desc student20903;
Name Null? Type
----------------------------------------- -------- ----------------------------
ROLLNO NUMBER(5)
FNAME CHAR(10)
LNAME CHAR(10)
ADDS VARCHAR2(25)
DOB DATE
SQL> create table stdnt_marks(rollno references student20903(rollno),seat_no char(5),sem1 number(3),sem2 number(3));
Table created.
SQL> desc stdnt_marks;
Name Null? Type
----------------------------------------- -------- --------------------------
ROLLNO NUMBER(5)
SEAT_NO CHAR(5)
SEM1 NUMBER(3)
SEM2 NUMBER(3)
SQL> CREATE TABLE STD_FEES( Rollno references student20903(ROLLNO),FEES_PAID NUMBER(5),FEES_BALANCE NUMBER(5));
Table created.
SQL> desc STD_FEES;
Name Null? Type
----------------------------------------- -------- ---------------------
ROLLNO NUMBER(5)
FEES_PAID NUMBER(5)
FEES_BALANCE NUMBER(5)
ALTER COMMANDS:
SQL> alter table student20903 modify(rollno number(6));
Table altered.
SQL> alter table student20903 add(mobno number(10));
Table altered.
SQL> alter table student20903 modify(rollno number(6) not null);
Table altered.
SQL> desc student20903;
Name Null? Type
----------------------------------------- -------- ----------------------------
ROLLNO NOT NULL NUMBER(6)
FNAME CHAR(10)
LNAME CHAR(10)
ADDS VARCHAR2(25)
DOB DATE
MOBNO NUMBER(10)
INSERT AND SELECT COMMAND:
SQL> insert into student20903 values(201,'Salekin','ansari','vashi','01-JAN-88',9920202021);
1 row created.
SQL> insert into student20903 values(202,'Rohan','patil','Thane','29-Feb-92',9967202021);
1 row created.
SQL> insert into student20903 values(203,'Gayas','choudhari','airoli',
'19-Feb-88',8067201121);
1 row created.
SQL> insert into student20903 values(204,'Mahesh','choudhari','airoli',
'11-Jan-86',9029794139);
1 row created.
SQL> insert into student20903 values(205,'Manoj','Gupata','Nerul',
'01-Jan-82',8088202321);