Data Definition Language (DDL)
Data Definition Language (DDL)
Data Definition Language (DDL)
DDL queries
Instructor: Bidur Devkota
13th Sept 2020
Data types:
MySQL supports SQL data types in several categories: numeric types, date and
time types, string (character and byte) types, spatial types,etc. More details are
available in the MySQL documentation.
https://dev.mysql.com/doc/refman/5.7/en/data-types.html
1
1. Create Database
Syntax:
CREATE DATABASE <DatabaseName>
Example:
USE infomax;
2. Create Table
Syntax:
CREATE TABLE <TableName> (
<Column1> <DataType>,
<Column2> <DataType>,
.
.
.
<ColumnN> <DataType>,
)
Example:
3. ALTER Table
desc students;
2
3.2. Modify column name and datatype
Syntax:
ALTER TABLE <TableName> RENAME TO <NewTableName> <DataType>
Syntax:
3
3.4 Delete column
Syntax:
ALTER TABLE <TableName> DROP COLUMN <ColumnName>;
4. Delete
table
Syntax:
DROP TABLE <TableName>
4
5. Delete Database
Syntax:
DROP DATABASE <DatabaseName>
Task:
Submission:
1. Title: 2. DDL Queries.
2. Theory: Explain about the related queries( syntax, Descriptions)
3. Observations: Queries you run and their screenshot.
4. Conclusion
Note:
1. Submit a file with name <2_DDL_Queries_ROLL_NAME.pdf>
For example student ‘Ram’ with roll number ‘100’ should send a file named:
2_DDL_Queries_100_Ram.pdf
2. Copying will be marked ZERO.
3. Send as email attachment to [email protected]
4. Email Subject: 2. DDL Queries