Experiment-03
Object:To create a set of operation in
simple database table using CREATE,INSERT,UNION,INTERSECTION and MINUS.
Requirement:Windows XP,Oracle 9i.
Program Code:
SQL>create
table avneesh
2 (name char(20),
3 id number(15),
4 dob date);
Table
Created.
SQL
>Insert into avneesh values(‘avneesh’,’1031030015’,’28-MAR-1992’);
1.row
created
SQL
>Insert into avneesh
values(‘ashish’,’1031030041’,’28-APR-1992’);
1.row
created
SQL
>Insert into avneesh
values(‘abhishek’,’1031030007’,’15-APR-1991’);
1.row
created
SQL>create
table avneesh1
2 (name char(20),
3
id number(15),
4
dob date,
5
place
char(20));
Table
Created.
SQL>Insert
into avneesh1 values(‘aman’,’1031030200’,’12-MAY-1994’,’varanasi’);
1.row
created
SQL>Insert
into avneesh1 values(‘avneesh’,’1031030015’,’28-MAR-1992’,’varanasi’);
1.row
created
SQL>Insert
into avneesh1 values(‘amol’,’1031030035’,’28-DEC-1993’,’mumbai’);
1.row
created
SQL>desc
avneesh;
Name
Null? Type
--------- --------------------
--------------------
Name
char(20)
Id
number(15)
Dob
Date
SQL>desc
avneesh1;
Name
Null? Type
--------- --------------------
--------------------
Name
char(20)
Id number(15)
Dob
Date
Place
char(20)
SQL>select
* from avneesh;
Name id dob
--------- --------------------
--------------------
avneesh 1031030015 28-MAR-1992
ashish 1031030041 28-APR-1992
abhishek 1031030007 15-APR-1991
SQL>select
* from avneesh1;
Name id dob place
---------
-------------------- --------------------
aman 1031030200 12-MAY-1994 varanasi
avneesh 1031030015 28-MAR-1992 varanasi
amol 1031030035 28-DEC-1993 mumbai
SQL>select
id from avneesh union select id from avneesh1;
id
------------------
1031030015
1031030041
1031030007
1031030200
1031030035
SQL>select
id from avneesh intersect select id from avneesh1;
id
-------------
1031030015
SQL>select id from avneesh minus select
id from avneesh1;
id
-------------
1031030007
1031030008
Result:The above database operation has been
done successfully.
0 comments:
Post a Comment