Archive by category "SQL"

Transact-SQL : Aggregate Functions

Aggregate function is T-SQL are sued to perform some calculations on multiple records or values in SQL table. Generally we use these function with Group By clause in Select statements. The aggregate functions are performed on a set of value and returns a single value. Also most of these function returns numeric values. In this article you can see that what are the aggregate functions that we can used in SQL.

Read More →

Transact-SQL – Using Try-Catch in Stored Procedure and Error Functions

Try-Catch is used to handling exception in C#. Today we will see that how this is also useful to handle errors in SQL also. The Try-Catch consists of two blocks Try block and Catch block. We just write our statements inside the Try block and when the error generate in the Try block the control is passed to Catch block and there we handle the error by writing statements.

Read More →

How to Normalize a DataBase Table : Step-4 Converting the 2NF to 3NF

The final step for most of databases to be normalized is converting the 2NF to 3NF. After converting the databse into the 3rd normalization form or 3NF most of database are normalized. While converting the 2NF to 3NF we remeber a rule that remove any non-key attributes to a new table that are more dependent on other non-key attributes than a table key.

Read More →

How to Normalize a DataBase Table : Step-3 Converting the 1NF to 2NF

The Next process of normalization is convert the first normalization form 1NF to second normalization form 2NF. In this process we will remove any non-key attributes that only depend on path of the table key to a new table. Enen many data sources normalized after the 2NF but some time we need to proceed for the next step also. But in this article w will see only to convert the 1NF to 2NF.

Read More →

How to Normalize a DataBase Table : Step-2 Converting the UNF to 1NF

As we have seen previously how to convert the data source to Un-Normalized Form also called UNF. Today we will proceed for the next step. In this step we transform the UNF into the first Normalization Form that is called 1NF. To accomplish this we need to remember a rule: we need to remove repeating attributes to a new table. here we will discuss the process to do this.

Read More →

How to Normalize a DataBase Table : Step-1 Converting the Data Source to UNF

Recently we have discusses about normalization and the procedure to normalize the data source. Today we will discuss about for this process. As you know that the first step in normalization is to convert the data source to Unnormalized Form that is also called UNF. If you will follow the process accurately then there will be no errors in the first step of normalization.

Read More →

Normalisation – A Technique to Design a Database System

The Normalisation is a data analysis technique to design a database system. The Normalisation allows the database designer to understand the current data structure within an organisation. The end result of a normalisation is a set of entity. We remove the unnecessary redudency by normalising the database table. Read More →

SQL Server: Using Alias Name with Select Statement

The Alias name is the name that is referred to any column name or table name that is given by user. The alias name also used to represent some column or table without using its real name. As we will proceed in this article we will see that how we can use both the alias column name and alias table name in SQL Server.

Read More →

Cast() Function in SQL Server

The Cast() Function is used to change the data type of a column. We can use the cast() function for various purpose.

Syntax:

Cast(Original_Expression as Desired_DataType)
 Read More →

Convert() Function in SQL Server

The convert() function is used to convert an expression of one  specific data type to another type. Also this function can be used to represent the value of date/time type variable in different different format. As we will discuss later in this post we will see how we accomplish this task.

Read More →