Download presentation
Presentation is loading. Please wait.
Published byThomas Sherman Modified over 6 years ago
1
SQL 101 with Tom Vorves zaq123 Jaquelin Lauren Inna Donna Ayesha
Manuel Jen Brett Blen Maria Tony Desktop\Instructor Exercise Files\Tom Vorves\SQL\SQL 101\DataBases\ Xtreme Northwind SQL 101 with Tom Vorves zaq123
2
SQL 101 with Tom Vorves zaq123 Brendan Tan Webster Sonia Calvin Rachel
Michael Greg Swati Gwen Colin Tara Tom Database files: Desktop\Instructor Exercise Files\Tom Vorves\SQL\SQL 101\DataBases\ Xtreme Northwind SQL 101 with Tom Vorves zaq123
3
Wednesday Union Pivot Parameters and Vars Join a table to self
Import SMS Query into Excel Use Excel to Query SMS Import Excel into SMS Copy Paste works Well too DML DQL Query a Query (Manuel) Power Pivot Views
4
Parameter Query use XTreme VARCHAR(20) = 'USA' SELECT * FROM [Customer] WHERE [Country]
5
Variable Query (Manuel)
use XTreme money = AVG([Last Year's Sales]) FROM [Customer]; Select * from [Customer] where [Last Year's Sales]
6
Temp Table Query use XTreme --drop table #mytemptable select *
into #mytemptable from [customer] where [country] = 'usa' and [Last Year's Sales] > ; --view the data select * from #mytemptable Later: update #mytemptable set Address1 = 4 where [Customer ID] = 14
7
Pivot Simple USE AdventureWorks2014;
-- Pivot table with one row and five columns SELECT 'AverageCost' AS Cost_Sorted_By_Production_Days, [0], [1], [2], [3], [4] FROM (SELECT DaysToManufacture, StandardCost FROM Production.Product) AS SourceTable PIVOT ( AVG(StandardCost) FOR DaysToManufacture IN ([0], [1], [2], [3], [4]) ) AS PivotTable;
8
Pivot Simple2 USE XTreme; -- Pivot table with one row and five columns
SELECT 'AverageSales' AS [Average Sales], [AZ], [CA], [NY], [WI], [NV] FROM (SELECT [Region], [Last Year's Sales] FROM Customer) AS SourceTable PIVOT ( AVG([Last Year's Sales]) FOR [Region] IN ([AZ], [CA], [NY], [WI], [NV]) ) AS PivotTable;
10
Pivot Complex USE AdventureWorks2014;
SELECT VendorID, [250] AS Emp1, [251] AS Emp2, [256] AS Emp3, [257] AS Emp4, [260] AS Emp5 FROM (SELECT PurchaseOrderID, EmployeeID, VendorID FROM Purchasing.PurchaseOrderHeader) p PIVOT ( COUNT (PurchaseOrderID) FOR EmployeeID IN ( [250], [251], [256], [257], [260] ) ) AS pvt ORDER BY pvt.VendorID;
11
DML use XTreme CREATE TABLE dbo.PurchaseOrderDetail (
PurchaseOrderID int NOT NULL ,LineNumber smallint NOT NULL ,ProductID int NULL ); insert into dbo.PurchaseOrderDetail values(1, 1, 1) select * from dbo.PurchaseOrderDetail update PurchaseOrderDetail set lineNumber = 4 where PurchaseOrderID = 11 drop table PurchaseOrderDetail
12
EXECUTING A SIMPLE QUERY
Connect to the SQL Database Import Data Query a Database Save a Query Modify a Query Execute a Saved Query
13
PERFORMING A CONDITIONAL SEARCH
Search Using a Simple Condition Compare Column Values Search Using Multiple Conditions Search for a Range of Values and Null Values Retrieve Data Based on Patterns
14
WORKING WITH FUNCTIONS
Perform Date Calculations Calculate Data Using Aggregate Functions Manipulate String Values
15
ORGANIZING DATA Sort Data TOPn Group Data Filter Grouped Data
16
Advanced data Retrieval
Combine Results of Two Queries Retrieve Data by Joining Tables Check for Unmatched Records Retrieve Information from a Single Table Using Joins
17
USING SUBQUERIES TO PERFORM ADVANCED QUERYING
Search Based on Unknown Values Find all Orders where the Order Amount > than the Average Order Amount Compare a Value with Unknown Values Perform Multiple-Level Subqueries Alias a Query for a Sub-Query (Manuel)
18
MANIPULATING TABLE DATA
Insert Data Modify and Delete Data
19
MANIPULATING THE TABLE STRUCTURE
Create a Table Create a Table with Constraints Add and Drop Table Columns Add and Drop Constraints Modify the Column Definition Back Up Tables Delete Tables
20
WORKING WITH VIEWS Create a View Manipulate Data in Views
Create Aliases Modify and Drop Views
21
INDEXING DATA Create Indices Drop Indices
22
MANAGING TRANSACTIONS
Create Transactions Commit Transactions
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.