Varias Consultas de Tablas

1
select soh.SalesOrderID,soh.Subtotal,sod.UnitPrice,sod.LineTotal from sales.SalesOrderHeader soh, sales.SalesOrderDetail sod select bec.BusinessEntityID, bec.PersonID, ct.ContactTypeID, ct.Name, be.ModifiedDate from Person.BusinessEntityContact bec, Person.ContactType ct, Person.BusinessEntity be /* like permite filtrar informacion con la condicion <NombreCampo>like 'letra %' */ select pp.ProductID, pp.Name, pc.ModifiedDate, ps.rowguid from Production.Product pp, Production.ProductCategory pc, Production.ProductSubcategory ps where pp.Name like 'b%' /* precio de lista entre 200 y 220 */ select he.BirthDate, he.JobTitle, pc.Name, pc.ModifiedDate, pp.ListPrice, pp.Size from HumanResources.Employee he, Person.CountryRegion pc, Production.Product pp where pp.ListPrice between 200 and 220 select he.BirthDate, he.JobTitle, pc.Name, pc.ModifiedDate, pp.ListPrice, pp.Size from HumanResources.Employee he, Person.CountryRegion pc, Production.Product pp where pp.ListPrice between 200 and 220 and he.JobTitle='Design Engineer' and DATEPART(yy,he.birthdate)=1961 and DATEPART(mm,he.birthdate)=5 and pc.Name like'z%' order by pc.Name asc select he.BirthDate, he.JobTitle, pc.Name, pc.ModifiedDate, pp.ListPrice, pp.ListPrice+(0.2*pp.ListPrice) as 'PrecioVenta' , pp.Size from HumanResources.Employee he, Person.CountryRegion pc, Production.Product pp where pp.ListPrice between 200 and 220 and he.JobTitle='Design Engineer' and DATEPART(yy,he.birthdate)=1961 and DATEPART(mm,he.birthdate)=5 and pc.Name like'z%'

description

para TALLER 2

Transcript of Varias Consultas de Tablas

Page 1: Varias Consultas de Tablas

select soh.SalesOrderID,soh.Subtotal,sod.UnitPrice,sod.LineTotalfrom sales.SalesOrderHeader soh, sales.SalesOrderDetail sod

select bec.BusinessEntityID, bec.PersonID, ct.ContactTypeID, ct.Name, be.ModifiedDatefrom Person.BusinessEntityContact bec, Person.ContactType ct, Person.BusinessEntity be

/* like permite filtrar informacion con la condicion <NombreCampo>like 'letra%' */select pp.ProductID, pp.Name, pc.ModifiedDate, ps.rowguidfrom Production.Product pp, Production.ProductCategory pc, Production.ProductSubcategory pswhere pp.Name like 'b%'

/* precio de lista entre 200 y 220 */select he.BirthDate, he.JobTitle, pc.Name, pc.ModifiedDate, pp.ListPrice, pp.Sizefrom HumanResources.Employee he, Person.CountryRegion pc, Production.Product ppwhere pp.ListPrice between 200 and 220

select he.BirthDate, he.JobTitle, pc.Name, pc.ModifiedDate, pp.ListPrice, pp.Sizefrom HumanResources.Employee he, Person.CountryRegion pc, Production.Product ppwhere pp.ListPrice between 200 and 220 and he.JobTitle='Design Engineer'and DATEPART(yy,he.birthdate)=1961 and DATEPART(mm,he.birthdate)=5and pc.Name like'z%'order by pc.Name asc

select he.BirthDate, he.JobTitle, pc.Name, pc.ModifiedDate, pp.ListPrice, pp.ListPrice+(0.2*pp.ListPrice) as 'PrecioVenta' , pp.Sizefrom HumanResources.Employee he, Person.CountryRegion pc, Production.Product ppwhere pp.ListPrice between 200 and 220 and he.JobTitle='Design Engineer'and DATEPART(yy,he.birthdate)=1961 and DATEPART(mm,he.birthdate)=5and pc.Name like'z%'