Aggregate Functions(Engineering > Computer Science And Engineering > Dbms Questions And Answers ) Questions and Answers
Question 1. Select __________ from instructor where dept name= 'Comp. Sci.';Which of the following should be used to find the mean of the salary ?
Mean(salary)
Avg(salary)
Sum(salary)
Count(salary)
Explanation:-
Answer: Option B. -> Avg(salary)
Avg(salary)Avg() is used to find the mean of the values.
Question 2. All aggregate functions except _____ ignore null values in their input collection.
Count(attribute)
Count(*)
Avg
Sum
Explanation:-
Answer: Option B. -> Count(*)
Count(*)* is used to select all values including null.
Question 3. Aggregate functions are functions that take a ___________ as input and return a single value.
Collection of values
Single value
Aggregate value
Both a & b
Explanation:-
Answer: Option A. -> Collection of values
Collection of values
Question 4. Select count (____ ID)from teacheswhere semester = 'Spring' and year = 2010;If we do want to eliminate duplicates, we use the keyword ______in the aggregate expression.
Distinct
Count
Avg
Primary key
Explanation:-
Answer: Option A. -> Distinct
DistinctDistinct keyword is used to select only unique items from the relation.
Question 5. A Boolean data type that can take values true, false, and________ .
1
0
Null
Unknown
Explanation:-
Answer: Option D. -> Unknown
UnknownUnknown values do not take null value but it is not known.
Question 6. We can test for the nonexistence of tuples in a subquery by using the _____ construct.
Not exist
Not exists
Exists
Exist
Explanation:-
Answer: Option B. -> Not exists
Not existsExists is used to check for existence of tuples.
Question 7. The ____ connective tests for set membership, where the set is a collection of values produced by a select clause. The ____ connective tests for the absence of set membership.
Or, in
Not in, in
In, not in
In, or
Explanation:-
Answer: Option C. -> In, not in
In, not inIn checks if the query has the value but not in checks if it does not have the value.