
USE AdventureWorks2012;
GO


SELECT SalesOrderID, ShipDate
FROM Sales.SalesOrderHeader
WHERE ShipDate BETWEEN '2002-07-28' AND '2014-07-29';



SELECT ProductID, Name
FROM Production.Product WHERE StandardCost < 110.00;



SELECT ProductID, Name
FROM Production.Product WHERE Weight IS NULL;



SELECT *
FROM Production.Product WHERE Color IN ('Silver', 'Black', 'Red');



SELECT *
FROM Production.Product WHERE Name LIKE 'B%';



UPDATE Production.ProductDescription
SET Description = 'Chromoly steel_High of defects' WHERE ProductDescriptionID = 3;

SELECT *
FROM Production.ProductDescription WHERE Description LIKE '%\_%' ESCAPE '\';



SELECT OrderDate, SUM(TotalDue) 
FROM Sales.SalesOrderHeader
WHERE OrderDate BETWEEN '2001-07-01' AND '2014-07-31'
GROUP BY OrderDate;



SELECT DISTINCT HireDate
FROM HumanResources.Employee;



SELECT AVG(DISTINCT ListPrice) AS Avg_Unique_ListPrice
FROM Production.Product;



SELECT 'The ' + Name + ' is only! ' + CAST(ListPrice AS VARCHAR) AS Product_Offer
FROM Production.Product
WHERE ListPrice BETWEEN 100 AND 120
ORDER BY ListPrice;



SELECT rowguid, Name, SalesPersonID, Demographics
INTO store_Archive
FROM Sales.Store;

SELECT COUNT(*) AS Row_Count
FROM store_Archive;



SELECT rowguid, Name, SalesPersonID, Demographics
INTO store_Archive_Empty
FROM Sales.Store
WHERE 1 = 0;



SELECT CONVERT(VARCHAR, GETDATE(), 101) AS Today_Style
UNION
SELECT CONVERT(VARCHAR, GETDATE(), 103)
UNION
SELECT CONVERT(VARCHAR, GETDATE(), 120);



SELECT @@VERSION;
SELECT @@SERVERNAME;

