0% found this document useful (0 votes)
22 views1 page

MS SQL

Uploaded by

Varshan kb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views1 page

MS SQL

Uploaded by

Varshan kb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

/*-----------------------DDL-OPERATION----------------------------------*/

////////////////////////Create////////////////////////////////////

create table Employee(ID int, Name varchar(20), Dept-Name int, Location varchar);

////////////////////////Alter///////////////////////////////////

1: Changing Datatype:-

Alter Table Employee Alter Dept-Name smallint;

2: Added new column into table:-

Alter Table Employee add Qulification varchar(20);

3: Rename the column name:-

Sp_Rename "Employee"."Location", "Loc"."column";

4.Drop the column name:-

Alter Table Employee Drop Qulification;

////////////////////////Rename-Table////////////////////////////////////

Sp_Rename Employee, Employee-Details;

////////////////////////Truncate the table//////////////////////////////

Truncate Table Employee;

////////////////////////Drop the table//////////////////////////////////

Drop Table Employee;

/*-----------------------DML-OPERATION-----------------------------------*/

////////////////////////Insert the table//////////////////////////////////

1:Explict Method:-

Insert into Employee-Details values(1, sam, Java, Banglore);

1:Implict Method:-

Insert into Employee-Details(ID , Name , Dept-Name , Location) values(1, sam, Java,


Banglore);

////////////////////////Update the table//////////////////////////////////

Update Employee-Details set where ID=2

You might also like