0% found this document useful (0 votes)
4 views3 pages

Ex 4

The document outlines the importance of SQL commands for database management, categorizing them into DDL, DML, DCL, DQL, and TCL. It details DDL commands such as CREATE, DROP, ALTER, TRUNCATE, and RENAME for defining database structures, and DML commands like INSERT, UPDATE, and DELETE for managing data within tables. Overall, it provides syntax and usage for each command type.

Uploaded by

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

Ex 4

The document outlines the importance of SQL commands for database management, categorizing them into DDL, DML, DCL, DQL, and TCL. It details DDL commands such as CREATE, DROP, ALTER, TRUNCATE, and RENAME for defining database structures, and DML commands like INSERT, UPDATE, and DELETE for managing data within tables. Overall, it provides syntax and usage for each command type.

Uploaded by

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

EX.

4 Development of database using DDL and DML commands

 SQL commands are essential for managing databases effectively.


 These commands are divided into categories such as Data Definition
Language (DDL), Data Manipulation Language (DML), Data Control
Language (DCL), Data Query Language (DQL), and Transaction Control
Language (TCL).

Data Definition Language (DDL):

These commands can be used to define, alter, and delete database structures
such as tables, indexes, and schemas.

DDL commands include:

1) CREATE
To create a new table in the database
Syntax:
CREATE TABLE table_name (column_name1 data type(size),
column_name2 data type(size), column_name3 data type(size),…);

2) DROP
Delete table from the database.
Syntax
DROP TABLE table_name;
3) ALTER
Alter the structure of the database
Syntax:
ALTER TABLE table_name
ADD/ DROP / MODIFY column_name datatype;

ADD is used to add a new column.


DROP is used to remove an existing column.
MODIFY is used to change the datatype or definition of an existing
column.

4) TRUNCATE
Removes all records from a table, leaving only the schema intact.
Syntax
TRUNCATE TABLE table_name;

5) RENAME
Rename an object or the name of the table existing in the database
Syntax
RENAME TABLE old_table_name TO new_table_name;
Data Manipulation Language (DML)
DML statements are used for managing data within the table.

DML commands:

1) INSERT
Insert data into a table
Syntax:
INSERT INTO table_name (column1, column2, ...) VALUES (value1,
value2, ...);

2) UPDATE
Update existing data within a table
Syntax
UPDATE table_name SET column1 = value1, column2 = value2 WHERE
condition;

3) DELETE
Delete records from a database table
Syntax
DELETE FROM table_name WHERE condition;

Inference:

Learnt about DDL and DML commands, its types, syntax and its uses.

You might also like