Advertisement
Shagy223

Untitled

Oct 31st, 2014
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1.  
  2. --Ej 4.3
  3.  
  4. --select
  5. -- color,
  6. -- avg(ListPrice)
  7. --from Production.Product
  8. --where ListPrice > 75
  9. ----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¨
  10. ----where Color in ('Black', 'Blue', 'Red') --equivalente al anterior where
  11. --group by Color --Agrupa todos los colores
  12. --having avg(ListPrice) > 700 --esta orden esta para dar una serie de condiciones al final de las instrucciones
  13.  
  14.  
  15. --Ej 4.2
  16.  
  17. --select Color
  18. --from Production.Product
  19.  
  20. --Ej 4.1
  21.  
  22. --select distinct(Color)
  23. --from Production.Product
  24.  
  25.  
  26. --Ej 3
  27.  
  28. --select count(*)
  29. --from Production.Product
  30. --where DaysToManufacture = 2
  31.  
  32.  
  33. --Ej 2
  34.  
  35. --select
  36. -- avg(ListPrice - StandardCost) as Promedio,
  37. -- min(ListPrice - StandardCost) as Minimo,
  38. -- max(ListPrice - StandardCost) as Maximo,
  39. -- sum(ListPrice - StandardCost) as Sumatoria,
  40. -- count(ListPrice - StandardCost) as Total
  41. --from Production.Product
  42.  
  43.  
  44.  
  45. --Ej 1
  46.  
  47. --select productid,
  48. --upper(name),
  49. --lower(ProductNumber),
  50. --listprice - standardcost as ganancia
  51. --from Production.Product
  52. --where ListPrice - StandardCost > 500 or ProductNumber like 'FR%'
  53. --order by ListPrice - StandardCost desc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement