Aggregation functions and constraints play a pivotal role in database management, enabling you to analyze and control data effectively. In this quiz, you'll explore a range of SQL aggregation functions such as SUM, AVG, MIN, and MAX, along with constraints like NOT NULL, UNIQUE, PRIMARY KEY, and FOREIGN KEY.
Question 1
Which SQL function is used to calculate the average value of a numeric column?
AVG()
SUM()
COUNT()
MAX()
Question 2
What does the SQL function "COUNT()" do?
Calculates the sum of values in a column
Counts the number of rows in a result set
Finds the maximum value in a column
Computes the median value of a column
Question 3
Which SQL function is used to find the highest value in a column?
AVG()
SUM()
COUNT()
MAX()
Question 4
What does the SQL function "SUM()" do?
Computes the median value of a column
Calculates the average value of a column
Finds the total sum of values in a column
Counts the number of rows in a result set
Question 5
Which SQL constraint is used to ensure that all values in a column are unique?
PRIMARY KEY
UNIQUE
CHECK
FOREIGN KEY
Question 6
What does the SQL constraint "PRIMARY KEY" do?
Ensures that all values in a column are unique
Specifies a default value for a column
Defines a column to uniquely identify each row in a table
Enforces a condition on the values allowed in a column
Question 7
Which SQL constraint is used to ensure that a column only contains values from a specified set?
PRIMARY KEY
UNIQUE
CHECK
FOREIGN KEY
Question 8
What does the SQL constraint "FOREIGN KEY" do?
Ensures that all values in a column are unique
Specifies a default value for a column
Links a column to a primary key in another table
Enforces a condition on the values allowed in a column
Question 9
Which SQL constraint is used to enforce a condition on the values allowed in a column?
PRIMARY KEY
UNIQUE
CHECK
FOREIGN KEY
Question 10
What does the SQL constraint "DEFAULT" do?
Ensures that all values in a column are unique
Specifies a default value for a column
Defines a column to uniquely identify each row in a table
Enforces a condition on the values allowed in a column
There are 10 questions to complete.