Clase de Taller 2

20
Clase número tres 17/09/2013: /*consultando la tabla dimproduct*/ Select *from DimProduct /*consultando la tabla factproductinvectory*/ Select *from FactProductInventory /*consultando la tabla dimdate*/ Select *from DimDate /*consultando la tabla dimproduct, con 3 campos y usando la condición ‘mallas para mujer, p’*/ select ProductKey,SpanishProductName,DealerPrice from DimProduct where SpanishProductName='Mallas para mujer, P' /*consultando la tabla dimproduct, con 3 campos y usando la condición dealerprice <10*/ select ProductKey,SpanishProductName,DealerPrice from DimProduct where DealerPrice <10 /*la cosulta anterior ordenandolo en forma ascendente*/ select ProductKey,SpanishProductName,DealerPrice from DimProduct where DealerPrice <10 order by SpanishProductName asc /*la cosulta anterior ordenandolo en forma descendente*/ select ProductKey,SpanishProductName,DealerPrice from DimProduct where DealerPrice <10 order by SpanishProductName desc /*listando los productos cuyo nombre en español inicia con la letra 'p'*/ select ProductKey,SpanishProductName,DealerPrice from DimProduct where SpanishProductName like 'p%' /*listando los productos cuyos precios son mayores o iguales a 5 pero memores o iguales a 10 ademas ordenados en forma descendente*/ select ProductKey,SpanishProductName,DealerPrice from DimProduct where DealerPrice between 5 and 10 order by SpanishProductName desc /*listando los productos incluido un campo de calculado llamado PrecioVenta, con la condicion que el precio de venta este en el rango de 5 a 10 y ordenado en forma descendente*/ select ProductKey,SpanishProductName,DealerPrice, (DealerPrice+(DealerPrice*0.3))as 'Precio de venta' from DimProduct where (DealerPrice+(DealerPrice*0.3)) between 5 and 10 order by SpanishProductName desc Clase número cuatro 24/09/2013: Nota: en el nombre de las tablas se puede utilizer el analisis. Ejemplo: Products alias p.

Transcript of Clase de Taller 2

Clase número tres 17/09/2013:

/*consultando la tabla dimproduct*/Select *from DimProduct

/*consultando la tabla factproductinvectory*/Select *from FactProductInventory

/*consultando la tabla dimdate*/Select *from DimDate

/*consultando la tabla dimproduct, con 3 campos y usando la condición ‘mallas para mujer, p’*/select ProductKey,SpanishProductName,DealerPrice from DimProductwhere SpanishProductName='Mallas para mujer, P'

/*consultando la tabla dimproduct, con 3 campos y usando la condición dealerprice <10*/select ProductKey,SpanishProductName,DealerPrice from DimProductwhere DealerPrice <10

/*la cosulta anterior ordenandolo en forma ascendente*/select ProductKey,SpanishProductName,DealerPrice from DimProductwhere DealerPrice <10order by SpanishProductName asc

/*la cosulta anterior ordenandolo en forma descendente*/select ProductKey,SpanishProductName,DealerPrice from DimProductwhere DealerPrice <10order by SpanishProductName desc

/*listando los productos cuyo nombre en español inicia con la letra 'p'*/select ProductKey,SpanishProductName,DealerPrice from DimProductwhere SpanishProductName like 'p%'

/*listando los productos cuyos precios son mayores o iguales a 5 pero memores o iguales a 10 ademas ordenados en forma descendente*/select ProductKey,SpanishProductName,DealerPrice from DimProductwhere DealerPrice between 5 and 10order by SpanishProductName desc

/*listando los productos incluido un campo de calculado llamado PrecioVenta, con la condicion que el precio de venta este en el rango de 5 a 10 y ordenado en forma descendente*/select ProductKey,SpanishProductName,DealerPrice, (DealerPrice+(DealerPrice*0.3))as 'Precio de venta' from DimProductwhere (DealerPrice+(DealerPrice*0.3)) between 5 and 10order by SpanishProductName desc

Clase número cuatro 24/09/2013:

Nota: en el nombre de las tablas se puede utilizer el analisis. Ejemplo: Products alias p.

Ejemplos

/*Visualizar los campos englishproductname y unitcost */ /*dimproduct (dp) factproductinventory(f)

Productkey(pk) productkey(fk)*/

select dp.englishproductname, f.unitcostfrom DimProduct dp inner join FactProductInventory fon f.ProductKey=dp.ProductKey

/*Visualizar la consulta anterior agregándole un campo calculado de precio de venta con una ganancia del 30%*/

select dp.englishproductname, f.unitcost,(f.unitcost+(f.unitcost *0.3)) as 'Precio de Venta'from DimProduct dp inner join FactProductInventory fon f.ProductKey=dp.ProductKey

/* Visualizar la consulta anterior agregándole el campo spanishdaynameofweek*/

/*dimDATE(dd) factproductinventory(f) dimproduct(dp) datekey(pk) productKey(fk) productkey(pk)*/

select dp.englishproductname, dd.spanishdaynameofweek,f.unitcost,(f.unitcost+( f.unitcost *0.3)) as 'Precio de Venta'from DimProduct dp inner join FactProductInventory fon f.ProductKey=dp.ProductKey inner join DimDate ddon f.Datekey=dd.Datekey

/*Visualizar la consulta anterior cuyos productos se vendieron el día viernes y el precio de venta fue mayor de 900*/

select dp.englishproductname, dd.spanishdaynameofweek,f.unitcost,(f.unitcost+( f.unitcost *0.3)) as 'Precio de Venta'from DimProduct dp inner join FactProductInventory fon f.ProductKey=dp.ProductKey inner join DimDate ddon f.Datekey=dd.Datekeywhere dd.spanishdaynameofweek='viernes'and (f.unitcost+( f.unitcost *0.3))>900

/*Visualizar la consulta anterior cuyos productos se vendieron el dia jueves y el precio de venta fue mayor de 1400*/

select dp.englishproductname, dd.spanishdaynameofweek,f.unitcost,(f.unitcost+( f.unitcost *0.3)) as 'Precio de Venta'from DimProduct dp inner join FactProductInventory fon f.ProductKey=dp.ProductKey inner join DimDate ddon f.Datekey=dd.Datekeywhere dd.spanishdaynameofweek='jueves'and (f.unitcost+( f.unitcost *0.3))>1400

/*Visualizar la consulta anterior cuyos productos se vendieron el dia viernes y el precio de venta fue mayor de 900, ordenandolo en forma descendente segun el precio de venta*/

select dp.englishproductname, dd.spanishdaynameofweek,f.unitcost,(f.unitcost+( f.unitcost *0.3)) as 'Precio de Venta'from DimProduct dp inner join FactProductInventory fon f.ProductKey=dp.ProductKey inner join DimDate ddon f.Datekey=dd.Datekeywhere dd.spanishdaynameofweek='viernes'and (f.unitcost+( f.unitcost *0.3))>900order by SpanishProductName desc

CLASE CINCO 01/10/2013:

POWER BUILDER

Space Word (crear una aplicación y sobre esa aplicación se programa)

DATOS WINDOWS MENU

APLICATION WINDOWS