T SQL
T SQL
Note: does not open anything from design mode always use T-SQL to solve problems.
1. Read this book and solved Exercises
After this you must handed on experience of
• Data filtering (where ,in and Between)
• Sorting Data( Order by )
• Date and Time Functions
• String function
• Case/IF statement
• Joins
• Sub-Queries
• Set Operators
• Aggregate Functions and Group by
• Window Function (Over ,Partition, Ranks etc)
• CTE and loops
• Pivoting and Un Pivoting Data
• View , UDF(user define function) and store procedures.
• DML statement (create , alter and drop )
• Indexes
Figure 1
Hint: You can calculate separately than combine Results using unions.
• Fill Missing Days with Zero Values
SELECT DueDateKey,
*
FROM dbo.FactInternetSales
WHERE LEFT(DueDateKey, 6) = '200507' AND
SalesTerritoryKey = 1
Figure 2
Like for DueDateKey 20050701 ProductKey, OrderDateKey, shipDate,CustomerKey and other rows
would be Zero.
• Find out Mean, Median, Mode, Row Number, Rank Dense Rank, Running Total, Q1, Q2
and Q3
Let first teach what is Mean, Median and Mode
• Mean= (1 + 2 + 2 + 3 + 4 + 7 + 9) / 7 = 4
• Median (the middle value ordered ascending) = 1, 2, 2, 3, 4, 7, 9 = 3
• Mode (most frequent value) = 1, 2, 2, 3, 4, 7, 9 = 2
---------------