1. Katie & Emil >BI Tutorials >SQL > sql tutorial for beginners
sql tutorial for beginners
Below you can find our SQL tutorial that is mostly
suitable for beginnersand those who want to learn
something new. It covers SQL language only that
usually can be applied to any software. We will use
SQL Server 2008 R2 for our examples but most
examples should work in different versions. Enjoy
our SQL Server Tutorial
Each tutorial will have plenty of examples and
screenshots that hopefully will help those who are new to SQL digest everything much
quicker and gain understanding of the language in much shorter period of time. What we
don’t necessarily show is proper and full syntax which we believe is usually too much for
someone who just wants to learn something useful and use it in practise therefore we decided
to provide always a few real life example in each tutorial page.
SQL Tutorial
What is a database? - Learn the basics of database concepts. I strongly recommend this
tutorial page.
o Normalization Process - to be created
o Reasons for normalization - We describe three main reasons for normalization in a
database.
What is SQL? - Find out what is SQL and what it is used for.
SQL Clauses list - Find out what is the correct order of SQL Clauses
SQL SELECT - Learn how to retrieve data from table(s) using SQL Select Statement.
SQL WHERE -Learn how to filter results/records with SQL WHERE Clause.
SQL GROUP BY -Learn how to Group By records with SQL GROUP By Clause.
o SQL GROUP BY with Count
o SQL Group by Year from Date field
SQL Union - Learn how to combine two or more queries using UNION operator
SQL Except - Learn how to show unique results of first query excepts results of second
query
Data Manipulation Language tutorial (DML):
Data Manipulation Language (DML) - Find out more about DML
2. SQL UPDATE -In this tutorial you will learn how to update records with where and joins
using SQL Update
SQL INSERT multiple rows -In this tutorial you will learn how you can using SQL insert
multiple rows at once.
SQL INSERT DATE - In this tutorial you will learn how to insert date into a field using
SQL INSERT
SQL INSERT if not exists - In this tutorial you will learn how to insert row if it does not
already exist.
SQL Joins Examples - shows to simple examples of inner and left outer joins.
Data Definition Language tutorial (DDL):
Data Definition language (DDL) - Find out more about DDL
SQL CREATE TABLE
SQL ALTER TABLE
o Constraints
o SQL Primary Key Constraint
o SQL Check Constraint
o SQL DEFAULT CONSTRAINT
o SQL UNIQUE Constraint
SQL DROP Statements
o SQL DROP TABLE
o SQL DROP VIEW
o SQL DROP PROCEDURE
o SQL DROP FUNCTION
SQL CREATE VIEW
SQL Server Tutorial
Below are articles that are more specifc to SQL Server.
SQL Server Performance tuning overview
SQL Check if column exists
SQL Check if table exists
SQL Check if record exists
SQL Check if record exists before insert
SQL Check if record exists before update
SQL Convert date and time int into datetime
SQL Check if schema exists
SQL age bands
3. SQL Find table size
SQL add primary key to table with existing primary key
SQL Substring function
SQL Update progress status
SQL Server Soundex
SQL Server move database to a different drive
SQL Server Shrink log file
T-SQL Current Date Using current date is one of the most common element when writing t-
sql queries
T-SQL Current Time Getting current time from a field is common requirement although not
so obvious in T-SQL
T-SQL YYYYMMDD This is one of them most common function used in data warehouses
T-SQL Month Name This is easily achieved using T-SQL function
T-SQL Last Month This is probably most often used by finance related reports
T-SQL Day Of Week Getting day of week is simple although users can complicate it. Sunday
= 1 or Monday = 1
T-SQL Find column name in database in any table
SQL Show running queries
T-SQL Check if database object exists
SQL Add Column
sql case sensitive string comparison
SQL Server orphaned users
SQL check if temp table exists
SQL Server wait for delay
SQL Update progress status
SQL Server restore database
SQL Server 2012 Add user login with sql server authantication
SQL Server 2012 AdventureWorks DW download and install
Other:
SQL Server Compressed backup without enterprise edition
SQL Server add Linked Server
The following link shows SQL Queries Examples from beginner to advanced