Community Sites
Create your own community website and start earning today !
It's Free !
 
Communities Members BookmarksPolls Fresher Jobs Funny Photos B.Tech Projects New Member FAQ  



My Profile
Active Members
TodayLast 7 Days more...



Awards & Gifts
Online Exams

Fresher Jobs


Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian cities including Bangalore, Chennai, Hyderabad, Pune or Kochi

Resources


Find educational articles, blogs, discussion threads and other resources.

Colleges


Find details about any college in India or search for courses.

website counter



OPERATORS IN SQL


Posted Date: 12 May 2008    Resource Type: Articles/Knowledge Sharing    Category: Education

Posted By: Nikky       Member Level: Gold
Rating:     Points: 1



(1) ARITHMETIC OPERATORS

Oracle allows arithmetic operators to be used while viewing records from the table or while performing Data Manipulations operations such as Insert, Update, and Delete.

These are: -

+ Addition * Multiplication
- Subtraction ** Exponentiation
/ Division ( ) Enclosed operation

Example: -
SQL> SELECT order_no,order_date, sale_amount*0.05 FROM sales_order;

ORDER_NO ORDER_DATE SALE_AMOUNT*2
---------- --------------- -------------
O191001 12-Apr-04 40000
O191002 23-Jun-04 96000
O191003 27-Oct-04 108000
O191004 27 -Feb-05 140000
O191005 17-Mar-05 180000

(2) LOGICAL OPERATOR

Logical operators that can be used in SQL sentences are: -

(a) The AND operator:
The Oracle engine will process all rows in a table and display the result only when all of the conditions specified using the AND operator are satisfied.

EXAMPLE: -
SQL> SELECT order_no, client_no, order_date, sale_amount FROM sales_order WHERE sale_amount>=10000 AND sale_amount<=50000;

ORDER_NO CLIENT_NO ORDER_DATE SALE_AMOUNT
---------- --------- --------------- -----------
O191001 C0006 12-Apr-04 20000
O191002 C0002 23-Jun-04 48000

(b) The OR operator:
The Oracle engine will process all rows in a table and display the result only when any of the conditions specified using the OR operator are satisfied.

EXAMPLE: -

SQL> SELECT order_no, client_no, order_date, sale_amount FROM sales_order WHERE (client_no=C0003 OR client_no=C0005);




ORDER_NO CLIENT_NO ORDER_DATE SALE_AMOUNT
---------- ---------- --------------- -----------
O191003 C0003 27-Oct-04 54000
O191004 C0005 27-Feb-05 70000

(c) The NOT operator:

The Oracle engine will process all rows in table and display the result only when none of the conditions specified using the NOT operator are satisfied.

EXAMPLE: -

SQL>SELECT order_no, client_no, sale_amount FROM sales_order WHERE NOT (sale_amount=20000 OR sale_amount=50000);

ORDER_NO CLIENT_NO SALE_AMOUNT
---------- ---------- -----------
O191002 C0002 48000
O191003 C0003 54000
O191004 C0005 70000
O191005 C0004 90000





Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: CONSTRAINTS IN SQL
Previous Resource: What is Machine.config?
Return to Discussion Resource Index
Post New Resource
Category: Education


Post resources and earn money!
 
Related Resources

Watch TV Channels



Contact Us    Privacy Policy    Terms Of Use   

SpiderWorks Technologies Pvt Ltd. 2006 - 2007 All Rights Reserved.