You are on page 1of 6

EXPERIMENT - 2

AIM:- EXECUTING ALL DDL AND DML COMMANDS


DML COMMAND
1. INSERT COMMAND- Insert command is used to add a new rows of data to a table
in the database.

SYNTAX:INSERT INTO TABLE- NAME VALUES ( Values1,valyes2,


values3......valueN);

2.SELECT COMMAND-Select command is used to show the query of data in data


base.

SYNTAX:-Select column1,column2,column3...columnN from table-name


Select* from table name

DDL COMMAND:
CREATE COMMAND:- Create command is used to create a table. We can
specify names and datatypes of various columns along.

Syntax-Create table table - name (column name datatype

ALTER COMMAND ADD COLUMN:


Alter command is used for alteration of table structures. There are various uses of
alter command, such as, to add a column to existing table, to change datatype of any
column of or modify its size, alter is also used to drop a column.

ADD
Alter command can add a new column to an existing table.

SYNTAX:-Alter table table name add(column- name datatype)

ALTER COMMAND MODIFY TABLE


MODIFY:Alter command is used to modify data type of an existing column.
SYNTAX:Alter table table name modify(column name datatype);

DROP COMMAND:=Alter command is also used to drop column also.


SYNTAX: -Alter table table name drop(column- name)

ALTER TABLE- RENAME:-Rename commnd is used to rename a table.


Syntax:Rename table old-table-name to new-table-name;

TURNCATE COMMAND
Truncate command removes all records from a table . but this command will not destroy the
tables structure. When we apply truncate command on a table its primary key is initialized .
SYNTAX:Truncate table table-name.

DROP COMMAND
Drop query completly removes a table from database .this command will also destroy the
table structure.
SYNTAX:Drop table table-name;

RENAME- TABLE NAME:


RENAME TABLE allows you to rename an exsiting table in any schema.
SYNTAX:Rename table table-name.

You might also like