Monday 31 March 2014

SQL Server Basic Concepts

What is SQL?

SQL is Structured Query Language, which is a computer language for storing, manipulating and retrieving data stored in the relational database. 

It is a standard language for Relational Database System.
All RDMS systems like MySQL,MS Access, Oracle, Sybase and SQL Server use SQL as standard database language.
They are using different dialects, such as
  • MS SQL Server using TSQL 
  • Oracle using PL/SQL 
  • MS Access version of SQL is called JET SQL (native format) etc. 

Why SQL?

  • Allow users to access data in RDMS systems. 
  • Allows users to describe data. 
  • Allows users to define the data in database and manipulate that data. 
  • Allows to embed within other languages using SQL modules, libraries & pre-compilers. 
  • Allows users to create and drop databases and tables. 
  • Allows users to create view, store procedure, functions in a database. 
  • Allows users to set permission on tables, procedures and views. 

History

  • 1970 - Dr. Edgar.F.”Ted” Codd of IBM is known as father of relational databases. He described a relational model for databases. 
  • 1974 - SQL appeared. 
  • 1978 - IBM worked to develop Codd’s ideas and released a product named System/R. 
  • 1986 - IBM developed the first prototype of relational database and standardized by ANSI. The 1st relational database was released by Relational Software and its later becoming Oracle. 

What is a database? 

Think of it this way, when the humans evolved from fishes and chipmunks, they started gathering objects. Stones, wood, precious metals, whatever they could put their hands on. This obsession with collecting objects continued in the virtual world too, it was rather a necessity. As the information systems spiraled out of control, keeping this information in an orderly fashion with easy retrieval became more and more complex. This is where the database systems came to the rescue!

A structured set of data held in a computer, especially one that is accessible in various ways.

What you see above is the simplest definition of a database. There are 2 main things to note here:
The data is structured
It is accessible in various ways

These are two of the most important requirements for a modern databases system, apart from security. The data should be stored in such a way that is easy to understand and easy to retrieve.

The relational model has to be by far the most popular database model in use today. All you need to know about it is that it stores the information in tables made up of rows and columns and the tables are connected to each other via keys.

Microsoft SQL Server

Microsoft SQL Server is one of the most widely used database systems today.

Microsoft SQL Server is a relational model database server produced by Microsoft.

Microsoft SQL Server Editions

MS SQL Server has different editions based on different end-user needs. You can find the edition of SQL Server running on your system by executing the following command.

select SERVERPROPERTY ('edition')

The above query will give one of the following results:
  1. Enterprise: Full blown.
  2. Evaluation: Full blown but only for evaluation.
  3. Developer: Full blown but can't be deployed on production system.
  4. Standard: Lesser high availability and performance feature than Enterprise.
  5. Express: The CUI based free edition of SQL Server.

Microsoft SQL Server: Other Features

Microsoft SQL Server not only provides basic database services, it also helps in managing complex tasks and creating automated reports using separate tools. In SQL Server 2012 there is a separate version as well called Business Intelligence.
Some of the tools that add on to the basic functionality of SQL Server  are:
  1. SSIS: SQL Server Integration Services lets you create packages that encapsulate complex tasks. These packages can then be deployed on any system.
  2. SSRS: SQL Server Reporting Services helps you to create clean, automated reports.
  3. SSAS: SQL Server Analysis Services is used to analyse massive amounts of data to make informed business decisions.

SQL Server Query Execution Plans for beginners – Clustered Index Operators

In this article we will continue discussing the various execution plan operators related to clustered indexes and what they do, when do the...