Learn T-SQL Commands with Samples
Skip Navigation Links
Home |
URL |
About
Skip Navigation Links.
Database
Create Database
Drop Database
Attach Database
Detach Database
Online Database
Offline Database
Snapshot Database
Backup Database
Trigger Database
Table
Create Table
Alter Table
Drop Table
Delete Table
Truncate Table
Temp Table
Create Table from another Table
Insert values into Table
View
Create View
Alter View
Drop View
Stored Procedure
Create SP
Alter SP
Drop SP
IMP SPs
Data Filtering
Where
In / Not In
Wildcards
Top
Data Grouping
Group By
Having
Compute
Joins
Inner Join
Left Join
Right Join
Full Join
Self Join
Cross Join
Trigger
Create After Trigger
Create Instead Of Trigger
Alter Trigger
Drop Trigger
Cursor
Fetch
Fetch Variable
Fetch (First, Next, Last, Prior)
Fetch Absolute
Fetch Relative
Fetch Firehose
Monitoring Cursor
Operators
Arithmetic
Comparison
Logical
Bitwise
String Concatenation
Set Operators
Union
Union ALL
Except
Intersect
Constraints
Not Null
Unique
Primary Key
Foreign Key
Check
Default
Functions
String Functions
Aggregate Functions
Math Functions
Date and Time Functions
Configuration Functions
System Functions
Conditional Processing
If..Else
Simple Case
Searched Case
GOTO
Looping
While
While..Break
While..Continue
Error Handling
Try...Catch
v.IMP Queries
Find n th Highest Salary
Count, Find, Delete Duplicate Rows
Method 1 CTE
Method 2 SubQry
Method 3 tempTables
Sort Rows in Specific Order
Generate CSV
Rotate Columns into Rows
Display Row Numbers
Find Max, Min Values in a Row
Arrays in SQL
Generate Random/Lottery Nos
Select TOP n Rows For Each Group
Find Data Between Two Dates
PIVOT and UNPIVOT Data
IMP Queries
XML
Raw
Auto
Explicit
Path
Query Performance
Use Joins instead of Subqueries
Use Parameterized Queries
Use BETWEEN instead of IN
Use LIKE instead of SUBSTRING
Use DISTINCT instead of GROUP BY
Index
Queries
Sub Queries
Recursive Queries
Normalization
First Normal Form
Second Normal Form
Third Normal Form
Create
User
User Defined Data Type
User Defined Table Type
User Defined Type
Role
Rule
Query Performance
*
Use Joins instead of Subqueries
:
*
Use Parameterized Queries
: Parameterized queries yield better performance by compiling the query only once and executing the compiled plan multiple times.
*
Use BETWEEN instead of IN
:
*
Use LIKE instead of SUBSTRING
:
*
Use DISTINCT instead of GROUP BY
:
*
Index
: