Professional Documents
Culture Documents
SQL Server Practica 9
SQL Server Practica 9
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 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;