Академический Документы
Профессиональный Документы
Культура Документы
Unidad 3
Autor
Isabel Ponce
Unidad 3
Objetivos
exec sp_helpsort
Abraham Bennet
Akiko Yokomoto
Albert Ringer
Ann Dull
...
Meander Smith
Michael O'Leary
Michel DeFrance
Morningstar Greene
Patti Smythe
Reginald BlotchetHalls
Order by / Nulos
(25 row(s) affected)
Distinct
(19 row(s) affected)
Funciones de Columna
select count(*)
from authors
retorna el número de renglones en la tabla
authors
27
(1 row(s) affected)
select count(*)
from authors
where state = 'CA'
retorna el número de autores que viven en
CA
15
(1 row(s) affected)
Sum
select sum(advance)
from titles
retorna el total de anticipos de todos los
autores
95,400.00
(1 row(s) affected)
Avg
select avg(price)
from titles
retorna el precio promedio de todos los
libros
14.77
(1 row(s) affected)
select avg(price)
from titles
where price > 10
retorna el precio promedio de los libros que
cuestan más de $10
17.94
(1 row(s) affected)
Group by
(7 row(s) affected)
Group by
select type
from titles
group by type
order by 1
type
(null)
business
mod_cook
popular_comp
psychology
trad_cook
UNDECIDED
(7 row(s) affected)
Group by y Nulos
(7 row(s) affected)
Group by y where
select type
from titles
where advance > 5000
group by type
type
business
mod_cook
popular_comp
psychology
trad_cook
(5 row(s) affected)
Group by
(7 row(s) affected)
select count(*)
from authors
group by count(*)
retornará error de sintaxis
Msg 144, Level 15, State 1
Cannot use an aggregate or a subquery in an
expression used for the bylist of a GROUP BY
clause.
Having
(3 row(s) affected)
(19 row(s) affected)
Uniones