DATETIME SELECT SELECT INTO DATE PAD STRING DYNAMIC SQL CURSOR MONEY FORMAT PERCENT STORED PROCEDURE SQL SERVER AGENT JOB OPTIMIZATION WHILE LOOP OVER PARTITION BY UPDATE
SITE SEARCH SQLUSA.com HEADLINES NEWS
SQL E/BOOKS   SQL 2014 PROGRAMMING   DOWNLOADS
SCRIPTS SQL 2005 SQL 2008 ARTICLES
SQL JOBS TWITTER FORMAT VIDEOS
How to find all the ball bearing locations on the factory floor?

Execute the following Microsoft SQL Server T-SQL script in SSMS Query Editor to find where all the ball bearings located:

-- T-SQL LIKE operator - WHERE clause predicate

USE AdventureWorks2008;

 

SELECT   Product = p.[Name],

         Location = l.[Name],

         p.ProductNumber,

         i.Quantity

FROM     Production.Product AS p

         INNER JOIN Production.ProductInventory AS i

           ON p.ProductID = i.ProductID

         INNER JOIN Production.Location AS l

           ON i.LocationID = l.LocationID

WHERE    p.[Name] LIKE ('%ball bearing%')

ORDER BY p.[Name],

         l.[Name]

/*

Product                 Location                ProductNumber     Quantity

BB Ball Bearing         Miscellaneous Storage   BE-2349           443

BB Ball Bearing         Subassembly             BE-2349           324

BB Ball Bearing         Tool Crib               BE-2349           585

Headset Ball Bearings   Miscellaneous Storage   BE-2908           422

Headset Ball Bearings   Subassembly             BE-2908           388

Headset Ball Bearings   Tool Crib               BE-2908           512

*/


 

Exam Prep 70-461
Exam 70-461
DATETIME SELECT SELECT INTO DATE PAD STRING DYNAMIC SQL CURSOR MONEY FORMAT PERCENT STORED PROCEDURE SQL SERVER AGENT JOB OPTIMIZATION WHILE LOOP OVER PARTITION BY UPDATE