Building the Right Environment to Support , Machine Learning and Deep Learning

Considering the following STOCKPRICE and its details.

CREATE TABLE 'STOCKPRICE' (
'ID' INT(11) NOT NULL,
'NAME' TEXT NOT NULL COLLATE 'utf8_bin',
'PRICE' INT(11) NOT NULL
)
COLLATE='utf8_bin'
ENGINE=InnoDB
;

Also, use the following to create sample as below.

INSERT INTO 'STOCKPRICE' ('ID', 'NAME', 'PRICE')  (1, 'ABC Ltd', 15);
INSERT INTO 'STOCKPRICE' ('ID', 'NAME', 'PRICE')  (2, 'XYZ Ltd', 19);
INSERT INTO 'STOCKPRICE' ('ID', 'NAME', 'PRICE')  (3, 'AAA Ltd', 16);

Now, you can find out the maximum, minimum values and of values in the PRICE column using the queries below:

For  value -- SELECT (PRICE) MAXPRICE FROM STOCKPRICE
For Min value -- SELECT MIN(PRICE) MINPRICE FROM STOCKPRICE
For SUM of all values -- SELECT SUM(PRICE) SUMPRICE FROM STOCKPRICE

 

Visit the DevX Tip Bank

 



Source link
thanks you RSS link
( http://www.devx.com/DevX/tip--the-max-min-and-sum-of-values-from-a-table-in-.html)

LEAVE A REPLY

Please enter your comment!
Please enter your name here