|
|
Custom Search
| |
|
| |
|
Perform Arithmetic Operations
When you need to perform calculations in SQL statement, you use arithmetic expression. An arithmetic expression can contain column names, numeric numbers, and arithmetic operators.
Read Prerequisites for this tutorial and practices if you haven't done so.
Consider the following facts when using arithmetic operations in a SELECT statement:
Practice #1: Arithmetic operation in SQL SELECT statement. In Firefox (not IE), copy and paste the following SQL to your SQLyog query window. To execute a query, move your cursor anywhere inside the query and then press F9. Note that the SQL needs to end with semi-colon. /*
Query result set - 2155 rows returned: Practice #2: Modulo arithmetic operation in SQL SELECT statement. In Firefox (not IE), copy and paste the following SQL to your SQLyog query window. To execute a query, move your cursor anywhere inside the query and then press F9. Note that the SQL needs to end with semi-colon. /*
Query result set - 77 rows returned: Practice #3: Integer division arithmetic operation in SQL SELECT statement. In Firefox (not IE), copy and paste the following SQL to your SQLyog query window. To execute a query, move your cursor anywhere inside the query and then press F9. Note that the SQL needs to end with semi-colon. /*
Query result set: Practice #4: Integer division arithmetic operation in SQL SELECT statement - round up. In Firefox (not IE), copy and paste the following SQL to your SQLyog query window. To execute a query, move your cursor anywhere inside the query and then press F9. Note that the SQL needs to end with semi-colon. /*
Query result set: Practice #5: Use Unary minus to change the sign of an argument in SQL SELECT statement. In Firefox (not IE), copy and paste the following SQL to your SQLyog query window. To execute a query, move your cursor anywhere inside the query and then press F9. Note that the SQL needs to end with semi-colon. /*
Query result set:
|
|||||||||||||||||||||||||||||||||||||
|
Copyright © 2010 GeeksEngine.com. All Rights Reserved. This website is hosted by LunarPages. No portion may be reproduced without my written permission. Software and hardware names mentioned on this site are registered trademarks of their respective companies. Should any right be infringed, it is totally unintentional. Drop me an email and I will promptly and gladly rectify it. |
| Home | Kung Fu Timer | Feedback | Terms of Use | Privacy Policy |