Câu hỏi phỏng vấn MySQL
Câu hỏi

What is an AGGREGATE function. Name few aggregate functions used in MySQL.

Câu trả lời

An aggregate function in MySQL is a function that performs a calculation on multiple values and returns a single value. This type of function is particularly useful for performing operations on a set of values to derive a single summarizing value, such as a sum, average, or count. Aggregate functions are often used in conjunction with the GROUP BY clause to group values into subsets before performing the calculation. They ignore NULL values during the calculation, except for the COUNT function, which counts NULL values when using the COUNT(*) syntax[1][2][3][4][5][6][7][8][9].

Here are a few commonly used aggregate functions in MySQL:

  • COUNT(): Returns the count of a number of rows in a table that match a specified condition. It can count all rows (COUNT(*)), only rows with non-NULL values in a specific column (COUNT(column_name)), or the number of distinct values in a column (COUNT(DISTINCT column_name))[3][4][5][6][7][11].

  • SUM(): Calculates the total sum of a numeric column. It adds up all the values in a specified column and returns the total[3][4][5][6][7][11].

  • AVG(): Returns the average value of a numeric column. It calculates the sum of all non-NULL values in the column and divides it by the number of non-NULL values[3][4][5][6][7][11]...

junior

junior

Gợi ý câu hỏi phỏng vấn

middle

What are Derived Columns. What possible problems can a derived column pose?

middle

What is the difference between commands create database and create schema in MySQL?

expert

What happens to a trigger in MySQL if an operation which trigger is associated with fails? Does the
trigger execute?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào