Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Practica #11

José Luis Santos Rosales

SR102013

Ejercicio #1
SELECT e.LastName, e.FirstName, edh.Department, edh.StartDate, edh.EndDate,
edh.Shift, edh.GroupName, edh.Title
FROM HumanResources.vEmployee e INNER JOIN HumanResources.vEmployeeDepartmentHistory
edh
ON e.BusinessEntityID =
edh.BusinessEntityID;

SELECT SalesPersonID, SUM(2004) AS TotalSales


FROM Sales.vSalesPersonSalesByFiscalYears
GROUP BY SalesPersonID;
Ejercicio #2
SELECT SalesOrderID
,OrderDate
,DATEADD(day,1,OrderDate) AS PromisedShipDate
FROM Sales.SalesOrderHeader;

SELECT SalesOrderID,
CustomerID,
DATEADD(day, ROW_NUMBER() OVER(
ORDER BY PurchaseOrderNumber), SYSDATETIME()) AS 'Row Number'
FROM Sales.SalesOrderHeader

Ejercicio #3
Select firstname ,lastname,len(lastname) as LastNameLength
FROM
Person.Person
WHERE
SUBSTRING(FirstName,
LEN(FirstName)-1,2) = 'el'
Ejercicio #4

SELECT
name,
PATINDEX('%Frame%', name) position
FROM
production.product
WHERE
name LIKE '%Yellow%'
ORDER BY
name;

You might also like