Which of the following functions can be used on both numeric as well as non numeric data?
MySQL supports all standard SQL numeric data types. These types include the exact numeric data types ( Show
The For information about how MySQL handles assignment of out-of-range values to columns and overflow during expression evaluation, see Section 11.1.7, “Out-of-Range and Overflow Handling”. For information about storage requirements of the numeric data types, see Section 11.7, “Data Type Storage Requirements”. For descriptions of functions that operate on numeric values, see Section 12.6, “Numeric Functions and Operators”. The data type used for the result of a calculation on numeric operands depends on the types of the operands and the operations performed on them. For more information, see Section 12.6.1, “Arithmetic Operators”. next → ← prev SQL Aggregate Functions
Types of SQL Aggregation Function1. COUNT FUNCTION
Syntax Sample table: PRODUCT_MAST
Example: COUNT() Output: 10 Example: COUNT with WHERE Output: 7 Example: COUNT() with DISTINCT Output: 3 Example: COUNT() with GROUP BY Output: Com1 5 Com2 3 Com3 2 Example: COUNT() with HAVING Output: Com1 5 Com2 3 2. SUM FunctionSum function is used to calculate the sum of all selected columns. It works on numeric fields only. Syntax Example: SUM() Output: 670 Example: SUM() with WHERE Output: 320 Example: SUM() with GROUP BY Output: Com1 150 Com2 170 Example: SUM() with HAVING Output: Com1 335 Com3 170 3. AVG functionThe AVG function is used to calculate the average value of the numeric type. AVG function returns the average of all non-Null values. Syntax Example: Output: 67.00 4. MAX FunctionMAX function is used to find the maximum value of a certain column. This function determines the largest value of all selected values of a column. Syntax Example: 30 5. MIN FunctionMIN function is used to find the minimum value of a certain column. This function determines the smallest value of all selected values of a column. Syntax Example: Output: 10 Next TopicDBMS SQL Join ← prev next → Which functions can be used on both numeric and nonMAX returns the greatest value in a specified column and can be used with both numeric and non-numeric data.
Which of the following functions can only be used with numeric values?The AVG function can be only used with numeric values.
Which of the following aggregate functions can not be applied on both number and character typed columns?You can use the aggregate functions with any type of column, with these exceptions: You can use sum and avg with numeric columns only—bigint, int, smallint, tinyint, unsigned bigint, unsigned int, unsigned smallint, decimal, numeric, float, and money. You cannot use min and max with bit datatypes.
What are the 5 aggregate functions?There are five aggregate functions, which are: MIN, MAX, COUNT, SUM, and AVG.
|