Database Reference
In-Depth Information
+ Addition
- Subtraction ** Exponential * Multiplication
/ Davison
( ) Enclosed Operation Example: Show the contents of the column 110% of the values con-
tained in the Cost_price of product_info table.
Sol:
SELECT
Product_ID,
Product_Name,
Date_of_purchase,1.1*Cost_price
FROM
product_info;
Using Functions
SQL has built-in functions available for your use, just like in application
development tools like Visual Basic, C etc. These functions allow you to extend your
productivity on the database server and not rely as much or at all on an application tool
to perform these tasks. This means you can get the results you want straight from the
server without having to write code in another language to manipulate that data to see
those results.
Aggregate Functions
Aggregate functions give you a single answer based on a set of data passed into
the function. These functions provide a particular statistic about the data set.
COUNT
For instance, a very highly used aggregate function is COUNT. COUNT takes a set of data
and counts the number of items in the set. It returns a single value, the count.
For example.
SELECT COUNT(Product_Name) AS num
FROM product_info;
It is also used to count all the rows of the result set without specifying a column name by
using *. This is used quite often to determine how many rows are in a particular table.
SELECT COUNT(*) FROM product_info;
SUM SUM function is used to return the sum (total) of the values in a specific column.
However, * will not work with SUM as it would not know what exactly you would like
to add together.
SELECT SUM(Cost_price)
FROM product_info;
MAX and MIN
Search WWH ::




Custom Search