SQL Archive

Cross Tab Queries using PIVOT in SQL

Some times we need to convert row to column in SQL. We can do that by using basic SQL query. But most of the time it may complex. For that MS SQL Server provides a built-in mechanism,PIVOT. This article describes a simple way to use pivot in SQL query. Summary of the article: What is

How to use Paging in SQL Queries?

Paging is one of the most important tasks when developers developed applications. This article describes how to use paging in SQL queries or How to select 5-10 records?. In SQL queries we can select first 1-10  records, 10-20 records, 20-30 records etc. Summery of the article: SQL ROW_NUMBER() Function Paging using Sub Queries Paging using

SQL query to convert column to row

During the creation of table maximum time we only consider the purpose and efficiency of the table. All time we don’t think about the reporting. Some times we may need to convert the columns in to row or vice versa. We can do that in different ways. This article provides a solution to convert the

Difference Between Primary Key and Unique Key

In relational database system primary key and unique key are two important concepts. Both are used to uniquely identify a row in a table. Though both can identify a row uniquely but there is some difference between them. This article explains a comparison between primary key and unique key. Summary of the article: What is

How to make a Great Primary Key?

The primary key is in important factor for any relational database. It plays a vital role. It has numerous functionalities. On a table we can create a primary key in different ways. But it is very important to choose an appropriate primary key. This article describes about the primary key and how to make a

Difference between Stored Procedure and Function

In a database system, stored procedures and functions are SQL statements that provide similar functionality. Both allow us to create bundles of SQL statements or codes that are stored on the server for future use. But they have some dissimilarities. This article describes a comparison   between SQL Function and Stored Procedure . Summary of the

SQL or Structured Query Language

This article describes introduction to SQL, basic overview of SQL. Summary of the article: What is SQL? Why we should Use SQL? SQL Statements SQL Commands SQL Functions What is SQL? Structured Query Language or SQL is a one kind of programming language used to handle data in Relational Database Management System (RDMS) like Oracle,

Update One Table with Another Table

Sometimes we need to update the data of one table with the data from another table in SQL. It can be done in different ways. We can use stored procedure, single SQL update statement or else. This article explains how to update one table by another table in SQL query. Summary of the article: Table

Error Handling or Exception Handling in SQL Server

Error handling or exception handling is the most vital part of any software development. Generally we are not interested to show any type of application error to end user. Error logs are very important for collecting all types of error data generated by an application. It is more useful during an early or beta release

Standard Naming Conventions for Database Design

Naming Conventions is an important factors for any type of database design. It’s benefits are high. It makes a simple database generic for others. This article describes what standard should we follow when naming database, database naming standards. Summary of the article: What is Naming Convention for Database? Standard Naming Convention for Tables Standard Naming