Q1
True / FalseThe COUNT function in MySQL can only be used with numeric columns.
The COUNT function in MySQL can be used with any column, not just numeric ones. It counts the number of rows returned by the query.
Q2
True / FalseThe SUM function in MySQL ignores NULL values in the column.
The SUM function in MySQL calculates the total of a numeric column, ignoring any NULL values.
Q3
True / FalseIn MySQL, the AVG function always returns an integer value.
The AVG function in MySQL returns the average value of a numeric column as a floating-point number, not necessarily an integer.
Q4
True / FalseThe MIN and MAX functions in MySQL can be used with date columns.
Both MIN and MAX functions in MySQL can be used with date columns to find the earliest and latest dates, respectively.
Q5
True / FalseMySQL, using the COUNT function with a specific column name will count only the non-NULL values of that column.
When using COUNT(column_name), MySQL counts only the rows where the specified column is not NULL.
Q6
True / FalseThe SUM function in MySQL can be used to add up the values of a string column.
The SUM function in MySQL is designed to work only with numeric columns, not string columns.
Q7
True / FalseIn MySQL, the AVG function will return NULL if all values in the column are NULL.
If all values in the column are NULL, the AVG function in MySQL will return NULL as there are no numeric values to calculate an average.
Q8
True / FalseMySQL’s COUNT function can be used with the DISTINCT keyword to count unique values.
The COUNT function in MySQL can be combined with the DISTINCT keyword to count the number of unique values in a column.
Q9
True / FalseThe MIN and MAX functions in MySQL can be used in the same query to find the range of values in a numeric column.
MIN and MAX functions can be used in the same query to determine the smallest and largest values in a numeric column, effectively giving the range.
Q10
True / FalseIn MySQL, the SUM and AVG functions can be used together in a single query to calculate both the total and average of a numeric column.
The SUM and AVG functions can be used together in a single query in MySQL to compute both the total sum and the average of values in a numeric column.
Q30
Multiple ChoiceWhich SQL query correctly uses the SUM, AVG, and MAX functions together to find the total, average, and maximum transaction amounts in the 'transactions' table?
SQL Code
SELECT SUM(transaction_amount) AS total_amount, AVG(transaction_amount) AS avg_amount, MAX(transaction_amount) AS max_amount
FROM transactions;
This query combines the SUM, AVG, and MAX functions to calculate the total, average, and maximum transaction amounts.