130 views
2 2 votes

Consider the following tables.

The following SQL query is executed:

SELECT AVG(TotalSales) AS AverageSales
FROM Product
LEFT OUTER JOIN ProductSales
ON Product.ProductCode = ProductSales.ProductCode
WHERE Rank = 'A';

What is the value of $\mathrm{AverageSales}$?

  1. $100$
     
  2. $150$
     
  3. $225$
     
  4. $275$

1 Answer

0 0 votes


The crucial rule is:

$\mathrm{AVG(attribute)}$ ignores $\mathrm{NULL}$ values.

Therefore the average is calculated using only $50$ and $250$.

It is not $\frac{50+0+250}{3}$ because $\mathrm{NULL}$ does not become zero.

So,

Answer : $\boxed{\mathrm{B}}$

Answer:
Position:
Show:

Related questions

3 3 votes
1 1 answer
239
239 views
GO Classes asked Oct 1
239 views
Relation $\mathrm{R}(\mathrm{at1},\mathrm{at2},\mathrm{at3})$ contains: $$\begin{array}{|c|c|c|} \hline \mathrm{at1} & \mathrm{at2} & \mathrm{at3} \\ \hline 12 & 15 & 510...
0 0 votes
1 1 answer
129
129 views
GO Classes asked Oct 1
129 views
A concert-ticket system contains $\mathrm{Sales}$ and $\mathrm{Payment}$.Relevant rules are:a row is placed in $\mathrm{Sales}$ when a purchase application is made; if pa...
2 2 votes
1 1 answer
126
126 views
GO Classes asked Oct 1
126 views
Consider the relation: $$\begin{array}{c}\mathbf{EmployeeQualification} \\[4pt]\begin{array}{|c|c|}\hline\mathrm{EmployeeCode} & \mathrm{Qualification} \\\hline\mathrm{S0...
2 2 votes
1 1 answer
124
124 views
GO Classes asked Oct 1
124 views
Consider,$\mathrm{Users}(\mathrm{userid},\mathrm{name},\mathrm{age})$$\mathrm{Dogs}(\mathrm{dogid},\mathrm{owner},\mathrm{name},\mathrm{breed},\mathrm{age})$$\mathrm{dogi...