Show Menu

SQL server Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.


Data is inform­ation which comes in different types. Like Names, Age or height.
Database is used to store data System­ati­cally, which also makes it easier to handle a lot of data. It is also known as a logical world.
Database Mangement System
4 Types - Hierac­hichal, Network, Relational and Object Oriented (which is the some used to save data in TABLE format).
Structured Query Language (SQL)
SQL can be used to INSERT, SEARCH, UPDATE and DELETE database records. SQL also helps optimizing and mainta­ining databases.


Step 1.
Launch, “SQL Server Instal­lation Center”, through an ISO. Before installing run, “System config­uration Checker”, to make sure you do not have any block in installing the software.
Step 2.
After test run, go to “insta­llation tab” choose “New SQL stand-­alone” to get a complete new SQL Server or the possib­ility to change existing SQL server.
Step 3.
Through setup, make sure to add an admini­str­ative account, to access your SQL server.
Step 4.
You will now have the proper SQL features and applic­ation installed.
SQL Server Tools:
Server manager config­uration
Contains many settings like Network config­uration settings. used for establ­ishing the services that we expect to be running while the server is up are actually running.
SQL Server Management Studio
Install on SQL Server through ISO or browser. System databases are installed for you as you install a new instance of SQL, which will be shown in the management studio.

Server roles

Can perform all activities on the database Engine instance.
Members can perform instan­ce-wide config­uration tasks.
Manage instan­ce-­level permis­sions.
Can terminate processes running on a database
Can add/remove linked servers from the database.
Allow the use of BULK INSERT statement on databases hosted on an instance.
Members can manage instance related files.
Create, alter, drop and restore databases hosted in an instance.
All logins are members of this role.

Database roles

Allow all database config­uration and management task.
allow the management on membership of fixed and flexible databa­se-­lev­el-­roles.
assign to security princi­pals, who needs to manage database access for logins.
allows backup role.
Be able to run any data definition language (DDL) command in the database
allow modifi­cation on a user’s Table such as “insert” and “delete”.
Allow the user to read all data from user tables.
Deny inserting, altering or deleting data from a database’s user tables.
deny a user to read data stored within a database’s user tables.


- .Net 3.5 SP1 is a requir­ement for SQL Server 2012
- SQL server 2012 requires minimum 6 GB HDD
- .Net 4.0 is a requir­ement that will be installed automa­tically during feature Instal­lation Step.
- Super VGA (800x600) or Higher resolution
- Powershell is a requir­ement
- Minimum Ram 512 MB, recomm­ended 1 GB (for Express edition) - 1 GB, 4 GB recomm­ended (all other editions)
- Internet explorer 7 or later versions.
- Minimum Processor speed X86 Processor (1.0 GHz), x64 Processor (1.4 GHz) Recomm­ended 2.0 GHz or faster.

4 types of system databases

Master database
- Most important out of the four databases.
- Contains system level inform­ation for the instance you’re in.
- Holds inform­ation of other databases you create.
- Contains the initia­liz­ation inform­ation for the SQL server, without it, the instance can’t start.
Model Database
- Act as a template for any database added to your instance
- All settings, objects, tables and basically all changes will be added to all databases you create.
- Management system database, has multiple jobs
- Tracks the SQ server agent which is used to shut your regular jobs like regular backups or data import­/export jobs.
- List all the backups and restores done in the instance.
- Take regular backups of this database that it contains valuable inform­ation
- Holds all temporary objects, created by you and by the database itself
- It will delete all changes and objects when the instance gets restarted.

Useful SQL Commands

Requesting a single column:
SELECT "­Col­umn­nam­e"
With " , " you can add more
FROM "­Tab­len­ame­"
Request All
FROM "­Tab­el-­nam­e"
writing to Tabel
INSERT INTO "­tab­eln­ame­"
VALUES ("Write the value of a given Column)
Selective search
SELECT "­Col­umn­nam­e"
FROM "­Tab­eln­ame­"
WHERE "­Col­umn­nam­e" = "­Value in column­"
Creating Tabel
CREATE TABEL "­tab­eln­ame­"
Delete option
DELETE FROM "­tab­eln­ame­"
WHERE "­val­ue"