## Exercise #11 (tips and solutions) |
||

Existence of standard aggregate function AVG solves all issues: However the forum shows the attempts to be distant from the general "grey" mass. Here is quite equivalent solution which, the truth, adds the extra operation in the procedural plan: Correctness of the following decision depends on available restrictions: Namely, if SUM (speed) ignores rows with NULL value of speed, expression SUM(1) will count up total of rows in PC table, which, in essence, is equivalent to use of COUNT(*). As a result the sum of speeds of all the personal computers except for rows with unknown speed will be calculated in numerator which will be divided by the total number of rows. Therefore all the presented solutions will be equivalent, if NULL values are inadmissible, i.e. there is restriction NOT NULL on a speed column . To return to discussion of exercise #11 To solve a problem on SQL-EX.RU |

aggregate functions
Airport
ALL
AND
AS keyword
ASCII
AVG
Battles
Bezhaev
Bismarck
C.J.Date
calculated columns
Cartesian product
CASE
cast
CHAR
CHARINDEX
Chebykin
check constraint
classes
COALESCE
common table expressions
comparison predicates
Computer firm
CONVERT
correlated subqueries
COUNT
CROSS APPLY
CTE
data type conversion
data types
database schema
date/time functions
DATEADD
DATEDIFF
DATENAME
DATEPART
DATETIME
DDL
DEFAULT
DEFAULT VALUES
DELETE
DISTINCT
DML
duplicates
EXCEPT
exercise (-2)
exercise 19
exercise 23
exercise 32
More tags

exercise 37
exercise 39
exercise 46
exercise 54
exercise 55
exercise 56
exercise 57
exercise 7
exercise 70
exercise 8
exercises
EXISTS
FLOAT
FROM
FULL JOIN
GROUP BY
grouping
Guadalcanal
HAVING
head ships
IDENTITY
IN
income
inner join
INSERT
INTERSECT
IS NOT NULL
IS NULL
ISNULL
join operations
laptop
launched year
LEFT
LEFT OUTER JOIN
LEN
LIKE
LTRIM
MAX
MIN
mistakes
MySQL
NOT
NOT IN
NULL
NULLIF
number sequences
number-sequence generation
numbering
ON DELETE CASCADE
OR
Oracle
ORDER BY
outcome
Outcomes
outer joins
OVER
paging
Painting
PARTITION BY
Pass_in_trip
PATINDEX
PC
PIVOT
PostgreSQL
predicates
primary key
printer
product
Ranking functions
recursive CTE
renaming columns
REPLACE
RIGHT
RIGHT JOIN
ROUND
rounding
ROW_NUMBER
ships
sorting
SQL Server
SQL Server 2012
SQL-92
sql-ex.ru
string functions
subquery
SUBSTRING
SUM
tables join
tips and solutions
Torus
Transact-SQL
Trip
TRUNCATE TABLE
type conversion
UNION
UNION ALL
UNKNOWN
UPDATE
varchar
WHERE
window functions
WITH
XML
XPath
XQuery
упражнение 23

The book was updated

*month ago*