Web Analytics Made Easy - Statcounter

How to rename a Table in Sql Server

To rename a column in a SQL Table following command can be reused: SP_RENAME  ‘old table name’, ‘New table name’ For example, if we want to rename the table from employee to employeemaster, following command can be used. SP_RENAME  ’employee’, ’employeemaster’ This command will rename the table from employee to employeemaster.

How to change the database collation

To change the collation of an database following commands can be used: ALTER DATABASE [database name] SET SINGLE_USER WITH ROLLBACK IMMEDIATE ALTER DATABASE  [database name]  COLLATE Newcollation ALTER DATABASE  [database name]  SET MULTI_USER For example , suppose if the name of your database is learningdb and you want to change the collation to the collation SQL_Latin1_General_CP1257_CI_AS, then following commands can be used:- ALTER DATABASE  learningdb  SET SINGLE_USER WITH ROLLBACKIMMEDIATE ALTER DATABASE  learningdb  COLLATE SQL_Latin1_General_CP1257_CI_AS ALTER DATABASE  learningdb  SET MULTI_USER

ACID Rules in Sql Server

ACID Rules This article will tell about the ACID Rules in SQL Server. It is a concept for evaluation of databases and their architecture. A:- (Atomicity) – Atomicity  states the principle of  All or none. This means that either all the SQL Statements within the transaction will be executed or no SQL statement will be executed. C:- Consistency:- Consistency … Read more

DML, DDL, DCL, TCL in SQL Server

Different Types of Sql Statements:-   DML DML is abbreviation of Data Manipulation Language. It is used to retrieve, store, modify, delete, insert and update data in database. Examples: SELECT, UPDATE, INSERT statements Select :- This Sql Statement is used to extract the data from one or combination of tables Update:- This Sql Statement is … Read more

Renaming a column in Sql Server

blank

 We often need to change the name of a column of a table to a new name. We  can do this with the help of the Exec Sp_rename command.  The Syntax of the Sp_rename is given below:-  Exec sp_rename ‘TableName.[OldColumnName]’, ‘[NewColumnName]’, ‘Column’  For example, suppose we have a table called Employee who has the following structure:- … Read more

Group by…..Having Clause

blank

Group By:- Group By clauses is used to groups rows based on the distinct values of the specified columns. The syntax of the Group by clause is:-   Select column1, column2, column3, aggregate_function(expression )            From TableName Where (condition)            Group By Column1, column2, column3 For Example, suppose we have a … Read more

Second Normal Form (2NF)

Second Normal Form (2NF) :-A table is said to be in its Second Normal Form if it satisfied the following conditions:- 1) It satisfies the condition for the First Normal Form (1NF), 2) It do not includes any partial dependencies where a column is dependent only a part of a primary key. For example suppose we have … Read more

Third Normal Form (3NF)

Third Normal Form (3NF) :- A table is said to be in the Third Normal form (3NF) if it satisfy the following conditions:- 1) It should be in the 2NF 2) It should not contain any transitive dependency which means that any non key column of the table should not be dependent on another non … Read more

First Normal form (INF)

First Normal Form (INF) A table is said to be in a First Normal Form (1NF) if it satisfy the following conditions:- 1)If the columns of the table only contain atomic values (Single, indivisible). 2)Primary key is defined for the table 3)All the columns of the table are defined on the primary key.The first condition … Read more

Database Normalization

Database Normalization Normalization Database Normalization can be defined as the process of organization the data to reduce the redundant table data to the minimum. This process is carried out by dividing the database into two or more than two tables and defining relationship between them so that deletion, updation and insertion can be made to … Read more