SQL Server Tutorial

 

sql server tutorial

SQL Server Tutorial

SQL Server is a relational database technology developed by Microsoft.

Transact-SQL (T-SQL) is an extension of SQL that is used in SQL Server. Transact-SQL is closely integrated into the SQL language, yet it adds programming constructs that are not native to SQL.

Our tutorial will start with the basics of SQL Server such as how to retrieve and manipulate data. Then we will move to the more advanced topics such as how to create tables, logins, users, functions, and procedures. We will conclude with a review of the functions that are proprietary to Transact-SQL.

With this tutorial, you should be on your way to becoming proficient in SQL Server and Transact-SQL.

Prerequisites

There are no prequisities for this SQL Server tutorial. You should be able to easily understand this tutorial and learn the basic concepts of SQL Server as you progress to the more advanced topics.

Now, let's get started!

Start Tutorial

Or jump directly to a topic in SQL Server:

SQL Server (Transact-SQL) Functions

Functions - AlphabeticalSQL Server (Transact-SQL) Functions listed alphabetically
Functions - CategorySQL Server (Transact-SQL) Functions listed by category

SQL Server Keys, Constraints and Indexes

Primary KeysCreate, alter, drop, enable and disable primary keys
Foreign KeysCreate, drop, enable and disable foreign keys
Unique ConstraintsCreate, add, and drop unique constraints
Check ConstraintsCreate, alter, drop, enable and disable check constraints
IndexesCreate, rename and drop indexes (Performance tuning)

SQL Server Privileges

Grant/Revoke PrivilegesGrant or revoke privileges (permissions)
Change PasswordChange a password for a user/login

SQL Server Database Administration

Users and LoginsIdentity used to connect to a SQL Server instance (create, alter, drop)

Database user to log into SQL Server (create, drop)

SQL Server Programming

FunctionsCreate and drop functions
ProceduresCreate and drop stored procedures
Literals (Constants)String, integer, decimal, and datetime literals
Declare VariablesDeclare variables and set variables
Loops and Conditional StatementsWHILE Loop, IF...ELSE statement
Sequences (Autonumber)Create and drop sequences
Comments within SQLHow to create comments within your SQL statement

SQL Server Comparison Operators

Comparison OperatorsOperators such as =, <>, !=, >, <, and so on

SQL Server Query Types

SELECT StatementRetrieve records from a table
SELECT TOP StatementRetrieve records from a table and limit results
SELECT INTO StatementCreate a new table with columns and data from another table
INSERT StatementInsert records into a table
UPDATE StatementUpdate records in a table
DELETE StatementDelete records from a table
DELETE TOP StatementDelete records and limit number of deletions
TRUNCATE TABLE StatementDelete all records from a table (no rollback)
UNION OperatorCombine 2 or more result sets (removes duplicates)
UNION ALL OperatorCombine 2 or more result sets (includes duplicates)
INTERSECT OperatorIntersection of 2 result sets
EXCEPT OperatorResult set of one minus the result set of another
SubqueriesA query within a query
PIVOT ClauseCreate a cross-tabulation query

SQL Server Joins

JOIN TablesInner and Outer joins

SQL Server Aliases

ALIASESCreate a temporary name for a column or table

SQL Server Clauses

DISTINCT ClauseRetrieve unique records
FROM ClauseList tables and join information
WHERE ClauseFilter results
ORDER BY ClauseSort query results
GROUP BY ClauseGroup by one or more columns
HAVING ClauseRestrict the groups of returned rows

SQL Server SQL Functions

COUNT FunctionReturn the count of an expression
SUM FunctionReturn the sum of an expression
MIN FunctionReturn the min of an expression
MAX FunctionReturn the max of an expression
AVG FunctionReturn the average of an expression

SQL Server Conditions

AND Condition2 or more conditions to be met
OR ConditionAny one of the conditions are met
AND and ORCombine AND and OR conditions
LIKE ConditionUse wildcards in a WHERE clause
IN ConditionAlternative to multiple OR conditions
NOT ConditionNegate a condition
IS NULL ConditionTest for a NULL value
IS NOT NULL ConditionTest for a NOT NULL value
BETWEEN ConditionRetrieve within a range (inclusive)
EXISTS ConditionCondition is met if subquery returns at least one row

SQL Server Tables and Views

CREATE TABLECreate a table
SELECT INTOCreate a table from another table's definition and data
ALTER TABLEAdd, modify or delete columns in a table; rename a table
DROP TABLEDelete a table
LOCAL TEMP TABLESTemporary tables that are distinct within modules and embedded SQL programs
GLOBAL TEMP TABLESTemporary tables that are distinct within SQL sessions
VIEWVirtual tables (views of other tables)

SQL Server Data Types

Data TypesData Types in SQL Server (Transact-SQL)

SQL Server Question and Answer

Question & AnswerVarious questions and answers

No comments:

Post a Comment

SQL Server: Joins

  SQL Server:   Joins This SQL Server tutorial explains how to use   JOINS , both INNER and OUTER JOINS, in SQL Server (Transact-SQL) with s...