Leave a comment

September 22, 2012 by Er.Hem Raj Thakur

For example:

Q.1:- What is DDL Command?

Answer:- DDL is abbreviation of Data Definition Language. It is used to create and modify the structure of database objects in database.

CREATE – Creates objects in the database
ALTER – Alters objects of the database
DROP – Deletes objects of the database
TRUNCATE – Deletes all records from a table and resets table identity to initial value.
In this chapter we learn how to create database and tables or how to alter Drop and Truncate the database table and its values.

here are the some importent Example:-

Create/Alter/Rename Database

1. Syntax:- Create database database name

I. Create database db_hemgoogali

and then execute this Query or press F5 key in your Keyboard.

Alter or Rename the Database name:-

// Rename the Database db_hemgoogali to db_hemgoogali1

USE master;

ALTER DATABASE Old Database MODIFY NAME = New Database
USE master;
ALTER DATABASE db_hemgoogali
Modify Name = db_hemgoogali1;

or through System Store Procedure

To rename database it is very common to use for SQL Server 2005 user :
EXEC sp_renameDB 'old_DB','new_DB'

execute this Query or press F5 key in your Keyboard. Your database name has been successfully Changed. Now we will talking about the “db_hemgoogali” database so the Next Topic is:- How to Create Table and add new Column or alter/Rename/Modify Columns name.

Q.2 :- How to create tables?

Answer:- 1. Syntax:- Create table table name(column1 data type(length),column2 data type(length),………..column6 data type(length)) etc.

Note:- We create some tables actualy we want to maintain perticular record of an Employee. So we have multipal tables for Example:-

  1. tbl_department, tbl_designation, tbl_country, tbl_state, tbl_district, tbl_area, tbl_employee

help of these table we learn about primary key,foreign key or auto increment fields.

To be continue learn about DLL Commands All DLL Commands




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: