Experiment-06
Object: To perform logical operations in
simple database table using AND,OR,NOT,BETWEEN,GROUP BY,ORDER BY, truncate, RENAME.
Requirement: Windows XP, Oracle 9i.
Program Code:
SQL>create
table abhik
2 (name char(20),
3
id number(20),
4
branch char(5),
5
class char(10));
Table created.
SQL>insert into abhik values(‘abhi’,’15’,’cse’,’a’);
1
row created.
SQL>insert into abhik values(‘jatin’,’82’,’cse’,’b’);
1
row created.
SQL>insert into abhik values(‘ashish’,’41’,’cse’,’a’);
1
row created.
Output:
SQL>desc
abhik;
Name
Null? Type
--------- --------------------
--------------------
NAME
CHAR(20)
ID
NUMBER(20)
BRANCH
CHAR(5)
CLASS
CHAR(10)
SQL>select
name from abhik where branch=’cse’ and class=’a’;
NAME
---------
abhi
ashish
SQL>select
name from abhik where branch=’cse’ or class=’a’;
NAME
---------
abhi
jatin
ashish
SQL>select
name from abhik where not branch=’cse’;
NAME
---------
ashish
SQL>select
name from abhik where id between 10 and 50;
NAME
---------
abhi
ashish
SQL>select
name from abhik order by name;
NAME
---------
abhi
jatin
ashish
SQL>rename
abhik to abhikeshri;
Table
renamed.
Result: The above logical operator has been successfully
executed on a database table.
0 comments:
Post a Comment