Posts

Showing posts from March, 2025

T-SQL (Transact-SQL) beginner's tutorial( AI generated )

T-SQL (Transact-SQL) is Microsoft's extension of SQL (Structured Query Language) used in SQL Server. It adds procedural programming, error handling, and transaction control to standard SQL. 1. Introduction to T-SQL SQL vs. T-SQL : SQL is a standard language for managing relational databases. T-SQL extends SQL with procedural features like variables, loops, and error handling. 2. Basic Querying SELECT Statement SELECT column1, column2 FROM TableName; Retrieve specific columns from a table. WHERE Clause SELECT * FROM Employees WHERE Age > 30; Filters rows based on conditions. ORDER BY Clause SELECT * FROM Employees ORDER BY LastName ASC; Sorts results in ascending or descending order. GROUP BY and HAVING SELECT Department, COUNT(*) AS EmployeeCount FROM Employees GROUP BY Department HAVING COUNT(*) > 5; Groups data and filters grouped results. 3. Data Manipulation (DML) INSERT INSERT INTO Employees (FirstName, LastName, Age) VALUES ('Joh...