0% found this document useful (0 votes)
7 views2 pages

Demo 2

The document contains SQL commands for creating and manipulating tables in a database. It demonstrates the creation of tables 'stud', 'tanish', and 'gurukul', along with various insert operations and the resulting errors due to unique constraint violations. The document also shows the retrieval of data from the 'tanish' and 'gurukul' tables.

Uploaded by

savliyatanish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Demo 2

The document contains SQL commands for creating and manipulating tables in a database. It demonstrates the creation of tables 'stud', 'tanish', and 'gurukul', along with various insert operations and the resulting errors due to unique constraint violations. The document also shows the retrieval of data from the 'tanish' and 'gurukul' tables.

Uploaded by

savliyatanish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

SQL> create table stud

2 (stu_no number(5)primary key,


3 stu_nm varchar(10),
4 stu_add varchar(10));

Table created.

SQL> create table tanish


2 (stu_no number(10),
3 stu_nm varchar(10));

Table created.

SQL> insert into tanish


2 values(10,'raj');

1 row created.

SQL> insert into tanish


2 values(11,'raj');

1 row created.

SQL> insert into tanish


2 values(10,'raj');

1 row created.

SQL> select * from tanish;

STU_NO STU_NM
---------- ----------
10 raj
11 raj
10 raj

SQL> insert into stud


2 values(1,'raj','rajkot');

1 row created.

SQL> insert into stud


2 values(1,'rajesh','surat');
insert into stud
*
ERROR at line 1:
ORA-00001: unique constraint (SYSTEM.SYS_C005465) violated

SQL> create table stud1


2 (stu_id number(10),
3 stu_nm varchar(100,
4 stu
5
SQL>
SQL> create table gurukul
2 (no number(5),
3 nm varchar(10),
4 adds varchar(10),primary key(no,nm,adds));

Table created.

SQL> insert into gurukul


2 values(1,'soham','sk');

1 row created.

SQL> insert into gurukul


2 values(2,'nilesh','vadia');

1 row created.

SQL> insert into gurukul


2 values(1,'jay','baroda');

1 row created.

SQL> insert into gurukul


2 values(100,'soham','delhi');

1 row created.

SQL> insert into gurukul


2 values(200,'goti','sk');

1 row created.

SQL> select * from gurukul;

NO NM ADDS
---------- ---------- ----------
1 soham sk
2 nilesh vadia
1 jay baroda
100 soham delhi
200 goti sk

SQL> insert into gurukul


2 values(1,'soham','sk');
insert into gurukul
*
ERROR at line 1:
ORA-00001: unique constraint (SYSTEM.SYS_C005466) violated

SQL> spool off;

You might also like