Está en la página 1de 4

INSTITUTO TECNOLOGICO SUPERIOR QUITO METROPOLITANO

NOMBRE: CHINCHERO PATRICIA


SEMESTRE: 2 DO “REDES Y TELECOMUNICACIONES”

-- Seleccionar los 9 productos, con menos stock en almacén, que pertenezcan a la categoria 3, 5 y 8.

select top 9*
from Products
where UnitsInStock>0 and
CategoryID in (3,5,8)

ProductID ProductName SupplierID CategoryID QuantityPerUnit UnitPrice UnitsInStock UnitsOnOrder ReorderLevel Discontinued

1 10 Ikura 4 8 12 - 200 ml jars 31,00 31 0 0 0

2 13 Konbu 6 8 2 kg box 6,00 24 0 5 0

3 16 Pavlova 7 3 32 - 500 g boxes 17,45 29 0 10 0

4 18 Carnarvon Tigers 7 8 16 kg pkg. 62,50 42 0 0 0

5 19 Teatime Chocolate Bisc… 8 3 10 boxes x 12 piec… 9,20 25 0 5 0

6 20 Sir Rodney's Marmalade 8 3 30 gift boxes 81,00 40 0 0 0

7 21 Sir Rodney's Scones 8 3 24 pkgs. x 4 pieces 10,00 3 40 5 0

8 22 Gustaf's Knäckebröd 9 5 24 - 500 g pkgs. 21,00 104 0 25 0

9 23 Tunnbröd 9 5 12 - 250 g pkgs. 9,00 61 0 25 0

--Seleccionar las órdenes de compra, realizadas por el empleado con código entre el 2 y 5,
--además de los clientes con código que comienzan con las letras de la A hasta la G, del 31 de julio de cualquier año.

select *from Orders


where EmployeeID in (2,4,5) and CustomerID like '[a-g]%'
and month (OrderDate)='07' and day (OrderDate)='31'

OrderID CustomerID EmployeeID OrderDate RequiredDate ShippedDate ShipVia Freight ShipName


1 10617 GREAL 4 1997-07-31 00:00:00.0… 1997-08-28 00:00:00.0… 1997-08-04 00:00:00.0… 2 18,53 Great Lakes Food Mar…
--Seleccionar las órdenes de compra, realizadas por el empleado con código 3,
--de cualquier año pero solo de los úlimos 5 meses (agosto-Diciembre)

select *from Orders


where EmployeeID in (3) and
month (OrderDate)>='08' and day (OrderDate)<='12'

OrderID CustomerID EmployeeID OrderDate RequiredDate ShippedDate ShipVia Freight ShipName


1 10273 QUICK 3 1996-08-05 00:00:00.0… 1996-09-02 00:00:00.0… 1996-08-12 00:00:00.0… 3 76,07 QUICK-Stop
2 10321 ISLAT 3 1996-10-03 00:00:00.0… 1996-10-31 00:00:00.0… 1996-10-11 00:00:00.0… 2 3,43 Island Trading
3 10346 RATTC 3 1996-11-05 00:00:00.0… 1996-12-17 00:00:00.0… 1996-11-08 00:00:00.0… 3 142,08 Rattlesnake Canyon Grocery
4 10352 FURIB 3 1996-11-12 00:00:00.0… 1996-11-26 00:00:00.0… 1996-11-18 00:00:00.0… 3 1,30 Furia Bacalhau e Frutos do Mar
5 10375 HUNGC 3 1996-12-06 00:00:00.0… 1997-01-03 00:00:00.0… 1996-12-09 00:00:00.0… 2 20,12 Hungry Coyote Import Store
6 10381 LILAS 3 1996-12-12 00:00:00.0… 1997-01-09 00:00:00.0… 1996-12-13 00:00:00.0… 3 7,99 LILA-Supermercado
7 10619 MEREP 3 1997-08-04 00:00:00.0… 1997-09-01 00:00:00.0… 1997-08-07 00:00:00.0… 3 91,05 Mère Paillarde
8 10625 ANATR 3 1997-08-08 00:00:00.0… 1997-09-05 00:00:00.0… 1997-08-14 00:00:00.0… 1 43,90 Ana Trujillo Emparedados y hela…
9 10662 LONEP 3 1997-09-09 00:00:00.0… 1997-10-07 00:00:00.0… 1997-09-18 00:00:00.0… 2 1,28 Lonesome Pine Restaurant
10 10693 WHITC 3 1997-10-06 00:00:00.0… 1997-10-20 00:00:00.0… 1997-10-10 00:00:00.0… 3 139,34 White Clover Markets
11 10697 LINOD 3 1997-10-08 00:00:00.0… 1997-11-05 00:00:00.0… 1997-10-14 00:00:00.0… 1 45,52 LINO-Delicateses
12 10699 MORGK 3 1997-10-09 00:00:00.0… 1997-11-06 00:00:00.0… 1997-10-13 00:00:00.0… 3 0,58 Morgenstern Gesundkost
13 10700 SAVEA 3 1997-10-10 00:00:00.0… 1997-11-07 00:00:00.0… 1997-10-16 00:00:00.0… 1 65,10 Save-a-lot Markets
14 10732 BONAP 3 1997-11-06 00:00:00.0… 1997-12-04 00:00:00.0… 1997-11-07 00:00:00.0… 1 16,97 Bon app'
15 10739 VINET 3 1997-11-12 00:00:00.0… 1997-12-10 00:00:00.0… 1997-11-17 00:00:00.0… 3 11,08 Vins et alcools Chevalier
16 10762 FOLKO 3 1997-12-02 00:00:00.0… 1997-12-30 00:00:00.0… 1997-12-09 00:00:00.0… 1 328,74 Folk och fä HB
17 10763 FOLIG 3 1997-12-03 00:00:00.0… 1997-12-31 00:00:00.0… 1997-12-08 00:00:00.0… 3 37,35 Folies gourmandes
18 10765 QUICK 3 1997-12-04 00:00:00.0… 1998-01-01 00:00:00.0… 1997-12-09 00:00:00.0… 3 42,74 QUICK-Stop
19 10768 AROUT 3 1997-12-08 00:00:00.0… 1998-01-05 00:00:00.0… 1997-12-15 00:00:00.0… 2 146,32 Around the Horn
20 10769 VAFFE 3 1997-12-08 00:00:00.0… 1998-01-05 00:00:00.0… 1997-12-12 00:00:00.0… 1 65,06 Vaffeljernet
21 10772 LEHMS 3 1997-12-10 00:00:00.0… 1998-01-07 00:00:00.0… 1997-12-19 00:00:00.0… 2 91,28 Lehmanns Marktstand
--Seleccionar los detalles de las órdenes de compras, cuyo monto del pedidio esten entre 10 y 100.

select * from Orders


where Freight between 10 and 100
OrderlD CustomerlD EmployeelD OrderDate RequiredDate ShippedDate ShipVia Freight ShipName
1 10248 VlNET 5 1996-07-04 00:00:00.0… 1996-08-01 00:00:00.0… 1996-07-16 00:00:00.0… 3 32,38 Vins et alcools Chevalier
2 10249 TOMSP 6 1996-07-05 00:00:00.0… 1996-08-16 00:00:00.0… 1996-07-10 00:00:00.0… 1 11,61 Toms Spezialitäten
3 10250 HANAR 4 1996-07-08 00:00:00.0… 1996-08-05 00:00:00.0… 1996-07-12 00:00:00.0… 2 65,83 Hanari Carnes
4 10251 VlCTE 3 1996-07-08 00:00:00.0… 1996-08-05 00:00:00.0… 1996-07-15 00:00:00.0… 1 41,34 Victuailles en stock
5 10252 SUPRD 4 1996-07-09 00:00:00.0… 1996-08-06 00:00:00.0… 1996-07-11 00:00:00.0… 2 51,30 Suprêmes délices
6 10253 HANAR 3 1996-07-10 00:00:00.0… 1996-07-24 00:00:00.0… 1996-07-16 00:00:00.0… 2 58,17 Hanari Carnes
7 10254 CHOPS 5 1996-07-11 00:00:00.0… 1996-08-08 00:00:00.0… 1996-07-23 00:00:00.0… 2 22,98 Chop-suey Chinese
8 10256 WELLl 3 1996-07-15 00:00:00.0… 1996-08-12 00:00:00.0… 1996-07-17 00:00:00.0… 2 13,97 Wellington lmportadora
9 10257 HlLAA 4 1996-07-16 00:00:00.0… 1996-08-13 00:00:00.0… 1996-07-22 00:00:00.0… 3 81,91 HlLARlON-Abastos
10 10260 OTTlK 4 1996-07-19 00:00:00.0… 1996-08-16 00:00:00.0… 1996-07-29 00:00:00.0… 1 55,09 Ottilies Käseladen
11 10262 RATTC 8 1996-07-22 00:00:00.0… 1996-08-19 00:00:00.0… 1996-07-25 00:00:00.0… 3 48,29 Rattlesnake Canyon Groc…
12 10265 BLONP 2 1996-07-25 00:00:00.0… 1996-08-22 00:00:00.0… 1996-08-12 00:00:00.0… 1 55,28 Blondel père et fils
13 10266 WARTH 3 1996-07-26 00:00:00.0… 1996-09-06 00:00:00.0… 1996-07-31 00:00:00.0… 3 25,73 Wartian Herkku
14 10268 GROSR 8 1996-07-30 00:00:00.0… 1996-08-27 00:00:00.0… 1996-08-02 00:00:00.0… 3 66,29 GROSELLA-Restaurante
15 10272 RATTC 6 1996-08-02 00:00:00.0… 1996-08-30 00:00:00.0… 1996-08-06 00:00:00.0… 2 98,03 Rattlesnake Canyon Groc…
16 10273 QUlCK 3 1996-08-05 00:00:00.0… 1996-09-02 00:00:00.0… 1996-08-12 00:00:00.0… 3 76,07 QUlCK-Stop
17 10275 MAGAA 1 1996-08-07 00:00:00.0… 1996-09-04 00:00:00.0… 1996-08-09 00:00:00.0… 1 26,93 Magazzini Alimentari Riun…
18 10276 TORTU 8 1996-08-08 00:00:00.0… 1996-08-22 00:00:00.0… 1996-08-14 00:00:00.0… 3 13,84 Tortuga Restaurante
19 10278 BERGS 8 1996-08-12 00:00:00.0… 1996-09-09 00:00:00.0… 1996-08-16 00:00:00.0… 2 92,69 Berglunds snabbköp
20 10279 LEHMS 8 1996-08-13 00:00:00.0… 1996-09-10 00:00:00.0… 1996-08-16 00:00:00.0… 2 25,83 Lehmanns Marktstand
21 10282 ROMEY 4 1996-08-15 00:00:00.0… 1996-09-12 00:00:00.0… 1996-08-21 00:00:00.0… 1 12,69 Romero y tomillo
22 10283 LlLAS 3 1996-08-16 00:00:00.0… 1996-09-13 00:00:00.0… 1996-08-23 00:00:00.0… 3 84,81 LlLA-Supermercado
23 10284 LEHMS 4 1996-08-19 00:00:00.0… 1996-09-16 00:00:00.0… 1996-08-27 00:00:00.0… 1 76,56 Lehmanns Marktstand
24 10285 QUlCK 1 1996-08-20 00:00:00.0… 1996-09-17 00:00:00.0… 1996-08-26 00:00:00.0… 2 76,83 QUlCK-Stop
25 10287 RlCAR 8 1996-08-22 00:00:00.0… 1996-09-19 00:00:00.0… 1996-08-28 00:00:00.0… 3 12,76 Ricardo Adocicados
26 10289 BSBEV 7 1996-08-26 00:00:00.0… 1996-09-23 00:00:00.0… 1996-08-28 00:00:00.0… 3 22,77 B's Beverages
27 10290 COMMl 8 1996-08-27 00:00:00.0… 1996-09-24 00:00:00.0… 1996-09-03 00:00:00.0… 1 79,70 Comércio Mineiro
28 10293 TORTU 1 1996-08-29 00:00:00.0… 1996-09-26 00:00:00.0… 1996-09-11 00:00:00.0… 3 21,18 Tortuga Restaurante
--mostrar cuantas veces se repite cada precio de los productos
--con precios mayores que 10 y repeticiones mayor que 2

select UnitPrice, count(*) as 'Repeticion de precios'


from Products
group by UnitPrice
having count(UnitPrice)>2

UnitPrice Repeticion de precios


1 10,00 3
2 14,00 4
3 18,00 4

También podría gustarte