All coursesSQL TutorialNumPy TutorialData Science Tutorial (Hinglish)
SQL Tutorial

SQL Basics

What is a SQL Statement and types of SQL statementsSQL Server Data typeUnderstanding Default Size of VARCHAR in SQL ServerWhat are Constraints in SQL?Normalization in DatabasesLogical Query Processing Phases in SQL

Querying Data

SQL Logical Operators with ExamplesANY and ALL operators used in SQLFiltering the data with TOP and OFFSET-FETCH In SQLOrder by index number in SQLSQL Server PaginationUNION, UNION All, INTERSECT, EXCEPT used in SQL ServerUse of Apply(Cross and Outer) operator in SQL serverCommon Table Expressions (CTEs) in SQLWindow Aggregate Functions in SQLWorking with Multiple Grouping Sets in SQL ServerPivoting and Unpivoting Data in SQL

Modifying Data

What is the difference between DELETE and TRUNCATE statements in SQL?SQL MERGE statementImplementing Transactions,Error Handling, and Dynamic SQL in SQLHow to use Magic (virtual) table INSERTED and DELETED in SQL server

Functions

What is Functions and Difference between Functions and Stored Procedures in SQL ServerSQL Server User-Defined Functions (UDF)What difference between the DATEPART() and DATENAME() functions?How to get first date of given date or month.How to get first date From month and FinyearDynamic Date Series in SQL Server (Financial Year + Calendar Year Handling)Split full name into first name and last name in SQLHow to one series with comma separate(any Delimiter) value split into in rowsHow to Two series with comma separate(any Delimiter) value split into in rows respectivelyHow to comma separate value by using XML in SQL server

Views, Procedures and Triggers

What is View in SQL serverUnderstanding Stored Procedures in MSSQLsp_executesql in SQL ServerTriggers in SQL serverUnderstanding Cursors in +SQL Server: A Complete GuideWhat is “CREATE TABLE TYPE” in SQL Server?How to use GOTO statement in SQL serverWAITFOR in sql server

Tables, Schema and Storage

Added columns in a table by dynamic waysDynamic CREATE TABLE Script in SQL ServerWhat are System Tables, File Tables, External Tables and Graph Tables in SQL ServerSYS and INFORMATION_SCHEMAGet All DataBase Tables Schema into Table/JSONMDF, NDF, LDF, and FilegroupsTable Partitioning in SQL ServerSQL Server Data Compression: A Complete DBA Guide

Indexes and Performance

SQL Server Index Complete GuideSQL Server index Creation by using tableIndex Rebuilding vs. Reorganization in SQL ServerHow to Drop All Non-Clustered Indexes Dynamically in SQL ServerSQL Server Index Optimization Automation (Missing & Unused Index Management)Statistics in SQL ServerUnderstanding Locking Hints in SQL Server: NOLOCK, ROWLOCK, and UPDLOCKWhat is Blocking in SQL, How to solve blocking, and Kill SessionSQL Server Deadlock & Performance Monitoring Made EasySQL Server Optimization Q&A

System Databases

SQL Server System DatabasesMaster Database in SQL ServerMSDB Database in SQL ServerModel & Resource Database in SQL ServerTempDB in SQL Server

Administration and Security

DBASQL Server Administration – Management Tools OverviewSQL Server Management Studio (SSMS) – Complete Beginner GuideSQL Server Configuration ManagerDatabase Permissions in SQL Server

Backup, Recovery and Replication

Database Backup in SQL ServerSQL Server Backup & Recovery Complete GuideLog Shipping (Ship Log) in SQL ServerWhat is the Replication in MS SQL serverDynamic Linked Server Management in SQL Server

Maintenance and Archiving

SQL Server Database Shrink MaintenanceData archive in SQL ServerSQL Server Data Archiving SystemSQL Server me Default Constraint Maintenance System (Auto Fix + Logging + Rollback)

SQL Server Agent and Automation

SQL SQL Server Agent: Automation Ka Powerhouse in SQL ServerServer AgentSQL Server Agent Jobs & Schedules – Complete Practical Guide (Step-by-Step)SQL Server Agent Alerts, Operators, Database Mail & Job Activity Monitor

XML and JSON

XML Data – Complete Conceptual Guide (SQL Server Perspective)JSON Data – Complete Conceptual Guide (SQL Server Perspective)

Import, Export and Utilities

Data Import from text/CSV file in SQL ServerSearch Any Value Across SQL Server DatabaseFind column in the whole database in sql serverGenerate SQL Server Scripts by Name PatternInsert <br> tag in SQL text stringSQL Server Multi-Level Approval Workflow with Auto Skip Logic

MySQL and PostgreSQL

What difference between between MySQL and MSSQLFunctions in MySQLStored Procedure in MySQLVariables In MySQLComparison of WHERE Clause Operators in MSSQL vs PostgreSQLUnderstanding Data Types and Variables in MSSQL vs PostgreSQLTable Types Comparison: SQL Server vs PostgreSQLThe ALTER TABLE statement in Microsoft SQL Server (MSSQL) and PostgreSQL

Interview Preparation

SQL Interview Q&A
LearnSQL TutorialQuerying Data

Order by index number in SQL

Lesson 10 of 96

PreviousNext
SQL
SELECT empid, lastname FROM HR.Employees
ORDER BY 1 DESC --order by first column

SELECT empid, lastname FROM HR.Employees
ORDER BY 2 DESC --order by second column 
PreviousFiltering the data with TOP and OFFSET-FETCH In SQLNextSQL Server Pagination

SQLDataDev footer

SQLDataDev

Practical SQL, Python, analytics, and data engineering tutorials for builders who learn by shipping.

Browse practical tutorials for SQL, Python, analytics, and data engineering with crawlable internal links that help readers discover related articles quickly.

Explore

  • SQL
  • Python
  • PySpark
  • Data Science
  • Misc.

Categories

  • Data Science
  • Database maintenance

Tools

  • SQL Formatter
  • All Tools

Search & Indexing

  • Homepage
  • About
  • Main Sitemap
  • Post Archive
  • Contact Us
  • Robots Rules

Copyright 2026 SQLDataDev. Practical tutorials for data builders.

Everything's organized so you can discover exactly what you're looking for — browse by category, search the archive, or explore related posts.