SQL*Plus: Release 11.1.0.6.
0 - Production on Mon Oct 27 13:06:15 2025
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Enter user-name: scott
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
BONUS TABLE
DEPT TABLE
EMP TABLE
SALGRADE TABLE
SQL> create table student(
2 sid number primary key,
3 name varchar(15) not null,
4 gender char(1),
5 phno number(10) unique);
Table created.
SQL> insert into student values(101,'Bindu','F',9738975992);
1 row created.
SQL> insert into student values(102,'Sindu','F',9738975982);
1 row created.
SQL> insert into student values(103,'Indu','F',9738975983);
1 row created.
SQL> insert into student values(104,'Indu','F',97387675983);
insert into student values(104,'Indu','F',97387675983)
*
ERROR at line 1:
ORA-01438: value larger than specified precision allowed for this column
SQL> insert into student values(104,'Indu','F',9738767593);
1 row created.
SQL> insert into student values(105,'Raju','M',9838767593);
1 row created.
SQL> insert into student values(106,'Dolu','M',9838727593);
1 row created.
SQL> insert into student values(107,'Golu','M',8838727593);
1 row created.
SQL> desc student;
Name Null? Type
----------------------------------------- -------- ----------------------------
SID NOT NULL NUMBER
NAME NOT NULL VARCHAR2(15)
GENDER CHAR(1)
PHNO NUMBER(10)
SQL> select * from student;
SID NAME G PHNO
---------- --------------- - ----------
101 Bindu F 9738975992
102 Sindu F 9738975982
103 Indu F 9738975983
104 Indu F 9738767593
105 Raju M 9838767593
106 Dolu M 9838727593
107 Golu M 8838727593
7 rows selected.
SQL> insert into student values(107,'Dinga','M',97387675983);
insert into student values(107,'Dinga','M',97387675983)
*
ERROR at line 1:
ORA-01438: value larger than specified precision allowed for this column
SQL> insert into student values(107,'Dinga','M',9738767598);
insert into student values(107,'Dinga','M',9738767598)
*
ERROR at line 1:
ORA-00001: unique constraint (SCOTT.SYS_C009674) violated
SQL> insert into student values(108,'Dinga','M',9738767598);
1 row created.
SQL> select * from student;
SID NAME G PHNO
---------- --------------- - ----------
101 Bindu F 9738975992
102 Sindu F 9738975982
103 Indu F 9738975983
104 Indu F 9738767593
105 Raju M 9838767593
106 Dolu M 9838727593
107 Golu M 8838727593
108 Dinga M 9738767598
8 rows selected.
SQL> commit;
Commit complete.
SQL> insert into student(sid,name,gender,phno) values(108,'Pinga','M',8778767598);
insert into student(sid,name,gender,phno) values(108,'Pinga','M',8778767598)
*
ERROR at line 1:
ORA-00001: unique constraint (SCOTT.SYS_C009674) violated
SQL> insert into student(sid,name,gender,phno) values(109,'Pinga','M',8778767598);
1 row created.
SQL> select * from student;
SID NAME G PHNO
---------- --------------- - ----------
101 Bindu F 9738975992
102 Sindu F 9738975982
103 Indu F 9738975983
104 Indu F 9738767593
105 Raju M 9838767593
106 Dolu M 9838727593
107 Golu M 8838727593
108 Dinga M 9738767598
109 Pinga M 8778767598
9 rows selected.
SQL> commit;
Commit complete.
SQL> create table employee
2 (eid number primary key,
3 e_name varchar(20) not null,
4 salary number not null,
5 phno number(10) check(length(phno)=10));
Table created.
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
BONUS TABLE
DEPT TABLE
EMP TABLE
EMPLOYEE TABLE
SALGRADE TABLE
STUDENT TABLE
6 rows selected.
SQL> insert into employee values(01,'Raju','M',9739067598);
insert into employee values(01,'Raju','M',9739067598)
*
ERROR at line 1:
ORA-01722: invalid number
SQL> insert into employee values(01,'Raju',5000,9739067598);
1 row created.
SQL> insert into employee values(02,'Golu',2000,9729067598);
1 row created.
SQL> insert into employee values(03,'Dolu',9000,9729060598);
1 row created.
SQL> insert into employee values(04,'Bolu',8000,9729060591);
1 row created.
SQL> insert into employee values(05,'Holu',4000,9129060591);
1 row created.
SQL> select * from employee;
EID E_NAME SALARY PHNO
---------- -------------------- ---------- ----------
1 Raju 5000 9739067598
2 Golu 2000 9729067598
3 Dolu 9000 9729060598
4 Bolu 8000 9729060591
5 Holu 4000 9129060591
SQL> create table visitors
2 (V_name varchar(20) not null,
3 V_gender char(1) not null,
4 phno number(10) check(length(phno)=10),
5 visited_houseno number(4) not null,
6 owner_name varchar(20) not null);
Table created.
SQL> insert into visitors values('Bolu','M',9729060591,1234,'Nolu');
1 row created.
SQL> insert into visitors values('Indu','F',9729099591,1224,'Alu');
1 row created.
SQL> insert into visitors values('Jaggu','M',8829099591,2224,'Polu');
1 row created.
SQL> insert into visitors values('Jadu','M',8829099331,2424,'Volu');
1 row created.
SQL> select * from visitors;
V_NAME V PHNO VISITED_HOUSENO OWNER_NAME
-------------------- - ---------- --------------- --------------------
Bolu M 9729060591 1234 Nolu
Indu F 9729099591 1224 Alu
Jaggu M 8829099591 2224 Polu
Jadu M 8829099331 2424 Volu
SQL> create table movie
2 (M_name varchar(20) not null,
3 Release_year number(4) check(length(Release_year)=4),
4 genre varchar(10) not null,
5 Director varchar(20) not null,
6 M_id number(4) primary key);
Table created.
SQL> commit;
Commit complete.
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
BONUS TABLE
DEPT TABLE
EMP TABLE
EMPLOYEE TABLE
MOVIE TABLE
SALGRADE TABLE
STUDENT TABLE
VISITORS TABLE
8 rows selected.
SQL> commit;
Commit complete.
SQL> insert into movie values('3 idiots',2009,'Comedy','Volu',9092);
1 row created.
SQL> insert into movie values('PK',2016,'Comedy','Golu',9290);
1 row created.
SQL> insert into movie values('OK',2018,'Horro','Bolu',1290);
1 row created.
SQL> insert into movie values('KKKK',2008,'Horror','Jolu',1890);
1 row created.
SQL> select * from movie;
M_NAME RELEASE_YEAR GENRE DIRECTOR M_ID
-------------------- ------------ ---------- -------------------- ----------
3 idiots 2009 Comedy Volu 9092
PK 2016 Comedy Golu 9290
OK 2018 Horro Bolu 1290
KKKK 2008 Horror Jolu 1890
SQL> create table product(
2 prod_name varchar(20) not null,
3 pod_id number(5) not null,
4 price number not null,
5 quantity number not null);
Table created.
SQL> insert into product values('Shampoo',0092,120,50);
1 row created.
SQL> insert into product values('Milk',1222,30,100);
1 row created.
SQL> insert into product values('Chips',1092,80,90);
1 row created.
SQL> insert into product values('Rice',8892,70,200);
1 row created.
SQL> insert into product values('Soap',9992,200,300);
1 row created.
SQL> select * from product;
PROD_NAME POD_ID PRICE QUANTITY
-------------------- ---------- ---------- ----------
Shampoo 92 120 50
Milk 1222 30 100
Chips 1092 80 90
Rice 8892 70 200
Soap 9992 200 300
SQL> create table train(
2 train_no number(6) check(lenght(train_no)=6),
3 start_loc varchar(10) not null,
4 destination varchar(10) not null,
5 passenger_capacity number(5) not null);
train_no number(6) check(lenght(train_no)=6),
*
ERROR at line 2:
ORA-00904: "LENGHT": invalid identifier
SQL> create table train(
2 train_no number(6) check(length(train_no)=6),
3 start_loc varchar(10) not null,
4 destination varchar(10) not null,
5 passenger_capacity number(5) not null);
Table created.
SQL> insert into train values(122092,'Bangalore','Kolar',8090);
1 row created.
SQL> insert into train values(122072,'Kolar','Bangalore',9000);
1 row created.
SQL> insert into train values(322072,'Hubli','Bangalore',5000);
1 row created.
SQL> insert into train values(322001,'Hubli','Mumbai',10000);
1 row created.
SQL> insert into train values(112072,'Mysuru','Bangalore',4000);
1 row created.
SQL> select * from train;
TRAIN_NO START_LOC DESTINATIO PASSENGER_CAPACITY
---------- ---------- ---------- ------------------
122092 Bangalore Kolar 8090
122072 Kolar Bangalore 9000
322072 Hubli Bangalore 5000
322001 Hubli Mumbai 10000
112072 Mysuru Bangalore 4000
SQL> create table attendance
2 (Name varchar(20) not null,
3 sid number primary key,
4 presence date not null,
5 Absent_no number not null);
Table created.
SQL> insert into train values('Golu',110,27-Oct-2025,10);
insert into train values('Golu',110,27-Oct-2025,10)
*
ERROR at line 1:
ORA-00984: column not allowed here
SQL> insert into train values('Golu',110,'27-Oct-2025',10);
insert into train values('Golu',110,'27-Oct-2025',10)
*
ERROR at line 1:
ORA-01722: invalid number
SQL> insert into attendance values('Golu',110,'27-Oct-2025',10);
1 row created.
SQL>
SQL> insert into attendance values('Molu',111,'27-Oct-2025',1);
1 row created.
SQL> insert into attendance values('Dolu',112,'27-Oct-2025',00);
1 row created.
SQL> insert into attendance values('Solu',113,'27-Oct-2025');
insert into attendance values('Solu',113,'27-Oct-2025')
*
ERROR at line 1:
ORA-00947: not enough values
SQL> insert into attendance values('Solu',113,'27-Oct-2025',00);
1 row created.
SQL> select * from attendance;
NAME SID PRESENCE ABSENT_NO
-------------------- ---------- --------- ----------
Golu 110 27-OCT-25 10
Molu 111 27-OCT-25 1
Dolu 112 27-OCT-25 0
Solu 113 27-OCT-25 0
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
ATTENDANCE TABLE
BONUS TABLE
DEPT TABLE
EMP TABLE
EMPLOYEE TABLE
MOVIE TABLE
PRODUCT TABLE
SALGRADE TABLE
STUDENT TABLE
TRAIN TABLE
VISITORS TABLE
11 rows selected.
SQL> commit;
Commit complete.
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
ATTENDANCE TABLE
BONUS TABLE
DEPT TABLE
EMP TABLE
EMPLOYEE TABLE
MOVIE TABLE
PRODUCT TABLE
SALGRADE TABLE
STUDENT TABLE
TRAIN TABLE
VISITORS TABLE
11 rows selected.
SQL>