DDL refers to Data Definition Language.This is used for defining a database.
Commands or Statements included under this category are:
1)CREATE
2)ALTER
3)DROP
CREATE:
CREATE statement is used to create databases or tables.
Creating a Database:
CREATE DATABASE <database name>;
Creating a table:
CREATE TABLE <table name>
(
<column name> <data type> <constraint>,
...
...
);
ALTER:
ALTER statement is basically used to modify a table.Modifying a table means modifying the structure of a table like column names,data types,constarints.For changing the values within a column use DML(please refer to DATA MANIPULATION LANGUAGE)
Altering a table:
ALTER <table name>
MODIFY COLUMN <column name> <data type>;
DROP:
Drop is basically used to drop a table.Dropping a table means deleting the entire table permanently(including data and the entire structure).
DROP TABLE <table name>;
IMPORTANT POINTS TO REMEBER:
1) If we you are using SQL workbench,After Creating a database always remember to use this database by:
USE <database name>.
2) Always use Capslock characters while writing SQL statements.
3) Always use ANSI standards.
Commands or Statements included under this category are:
1)CREATE
2)ALTER
3)DROP
CREATE:
CREATE statement is used to create databases or tables.
Creating a Database:
CREATE DATABASE <database name>;
Creating a table:
CREATE TABLE <table name>
(
<column name> <data type> <constraint>,
...
...
);
ALTER:
ALTER statement is basically used to modify a table.Modifying a table means modifying the structure of a table like column names,data types,constarints.For changing the values within a column use DML(please refer to DATA MANIPULATION LANGUAGE)
Altering a table:
ALTER <table name>
MODIFY COLUMN <column name> <data type>;
DROP:
Drop is basically used to drop a table.Dropping a table means deleting the entire table permanently(including data and the entire structure).
DROP TABLE <table name>;
IMPORTANT POINTS TO REMEBER:
1) If we you are using SQL workbench,After Creating a database always remember to use this database by:
USE <database name>.
2) Always use Capslock characters while writing SQL statements.
3) Always use ANSI standards.
Sunday
//
Labels:
SQL
//
0
comments
//
0 comments to "DATA DEFINITION LANGUAGE"
Powered by Blogger.
Post a Comment