289 views
1 votes
1 votes

Given the following relation $R$
$$\textbf{R}$$$$\begin{array}{|c|c|c|c|c|c|c|}
\hline 
\textbf{A} & \textbf{B} \\
\hline
1 & \text{NULL}
\\ \hline
1 & \text{NULL}
\\ \hline
\text{NULL} & \text{1}
\\ \hline
4 & \text{NULL}
\\ \hline
\end{array}$$
The output of the following query will be ____________

select sum(A) + avg(A) + sum(B) + avg(B) from R

1 Answer

Best answer
2 votes
2 votes
Except for $\text{count}(^{\ast}) ,$ aggregate functions ignore null values.

Now, $\text{sum(A) } = 6, \text{avg(A)} = \dfrac{6}{3} = 2,\text{sum(B) } = 1, \text{avg(B)} = \dfrac{1}{1} = 1.$

$\therefore \text{sum(A) } + \text{avg(A)} + \text{sum(B) } + \text{avg(B)} = 6 + 2 + 1 + 1 = 10.$

So, the correct answer is $10.$
selected by
Answer:

Related questions

4 votes
4 votes
1 answer
1
gatecse asked Oct 8, 2020
367 views
Consider the following relation $R$$$\textbf{R}$$$$\begin{array}{|c|c|c|c|c|c|c|}\hline\textbf{A} & \textbf{B} \\\hline1 & \text{NULL} \\\hline1 & \text{NULL} \\\hline\te...
3 votes
3 votes
1 answer
2
gatecse asked Oct 8, 2020
344 views
Consider the following relation.$$\textbf{Emp}$$$$\begin{array}{|c|c|c|c|c|c|c|}\hline\underline{\textbf{EmpId}} & \textbf{DeptNo} & \textbf{EmpName} & \textbf{Salary} \\...
2 votes
2 votes
1 answer
3
gatecse asked Oct 8, 2020
274 views
Consider the following relation instance.$$\textbf{Student}$$$$\begin{array}{|c|c|c|c|c|}\hline \textbf{Roll}& \textbf{FirstName} & \textbf{LastName} & \textbf{Weight}\\\...
4 votes
4 votes
2 answers
4
gatecse asked Oct 8, 2020
464 views
Consider the following relations.$$\textbf{Emp}$$$$\begin{array}{|c|c|c|c|c|c|c|} \hline\underline{\textbf{EmpId}} & \textbf{DeptNo} & \textbf{EmpName} & \textbf{Salary} ...