Revision Mysql Functions & Group by.docx
Revision Mysql Functions & Group by.docx
CLASS : XII
COMPUTER SCIENCE
FUNCTIONS IN MYSQL
Single row functions operate on a single value and return a single value.
When applied to a table, they return a single result for every row of the
queried table.
String functions
Numeric functions
Date & time functions
Function Description
For Ex:
Group by clause helps up to divide the records table into logical groups
based on any column value.
In those logically divided group of records we can apply aggregate
functions.
Syntax:
For. Ex
Example:
(i) To display game type and the number of each type of game.
SELECT type , count(type) FROM Game GROUP BY type;
(ii) To display the maximum prize money in each types of game.
SELECT type , max(prizemoney) FROM Game
GROUP BY type;
(iii) To display sum of PrizeMoney for each Type of GAMES.
SELECT type , sum(prizemoney) FROM Game
GROUP BY type;
2. Consider the following table CABHUB. Write SQL commands for the
following statements: