Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Ej 4.3
- --select
- -- color,
- -- avg(ListPrice)
- --from Production.Product
- --where ListPrice > 75
- ----where Color = 'Black' or Color = 'Blue' or Color = 'Red' --Solo agrupa el negro, Azul y Rojo ¨agrupar es dar el resultado para cierto grupo de datos¨
- ----where Color in ('Black', 'Blue', 'Red') --equivalente al anterior where
- --group by Color --Agrupa todos los colores
- --having avg(ListPrice) > 700 --esta orden esta para dar una serie de condiciones al final de las instrucciones
- --Ej 4.2
- --select Color
- --from Production.Product
- --Ej 4.1
- --select distinct(Color)
- --from Production.Product
- --Ej 3
- --select count(*)
- --from Production.Product
- --where DaysToManufacture = 2
- --Ej 2
- --select
- -- avg(ListPrice - StandardCost) as Promedio,
- -- min(ListPrice - StandardCost) as Minimo,
- -- max(ListPrice - StandardCost) as Maximo,
- -- sum(ListPrice - StandardCost) as Sumatoria,
- -- count(ListPrice - StandardCost) as Total
- --from Production.Product
- --Ej 1
- --select productid,
- --upper(name),
- --lower(ProductNumber),
- --listprice - standardcost as ganancia
- --from Production.Product
- --where ListPrice - StandardCost > 500 or ProductNumber like 'FR%'
- --order by ListPrice - StandardCost desc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement