0% found this document useful (0 votes)
10 views

Basic DDL Commands

1) The document demonstrates basic data definition language (DDL) commands in MySQL like CREATE TABLE, INSERT, ALTER TABLE, TRUNCATE TABLE, and DROP TABLE. 2) It creates a table called "mark" with columns for student name, roll number, and marks in 3 subjects, then inserts 3 records. 3) An ALTER TABLE command adds a column for department, another modifies the data type of roll number, and one drops the roll number column. 4) TRUNCATE TABLE empties the table and DROP TABLE removes the table.

Uploaded by

Mani Kandan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Basic DDL Commands

1) The document demonstrates basic data definition language (DDL) commands in MySQL like CREATE TABLE, INSERT, ALTER TABLE, TRUNCATE TABLE, and DROP TABLE. 2) It creates a table called "mark" with columns for student name, roll number, and marks in 3 subjects, then inserts 3 records. 3) An ALTER TABLE command adds a column for department, another modifies the data type of roll number, and one drops the roll number column. 4) TRUNCATE TABLE empties the table and DROP TABLE removes the table.

Uploaded by

Mani Kandan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

BASIC DDL COMMANDS

OUTPUT:
Mysql> Create table mark ( stud_name char(15), rollno int, mark1 int,mark2 int, mark3 int); Mysql> Insert into mark values ( Manikandan ,01,60,83,89); Mysql>Insert into mark values ( Kishore ,02,57,57,90); Mysql>Insert into mark values ( Prasanth ,03,75,91,90); Mysql>select * from mark; Mark Stud_name Manikandan Kishore Prasanth Rollno 01 02 03 Mark1 60 57 75 Mark2 83 57 91 Mark3 89 90 90

Mysql> Alter table mark add Dept char(3) after stud_name; Mqsql>select * from mark; Mark Stud_name Manikandan Kishore Prasanth Dept Null Null Null Rollno 01 02 03 Mark1 60 57 75 Mark2 83 57 91 Mark3 89 90 90

Mysql> Alter table mark modify (rollno varchar(15)); Mysql> Alter table mark drop column rollno; Mysql>select * from mark; Mark Stud_name Manikandan Dept Null Mark1 60 Mark2 83 Mark3 89

Kishore Prasanth

Null Null

57 75

57 91

90 90

Mysql> Truncate table mark; Mysql>select * from mark;

Mark Stud_name Dept Mark1 Mark2 Mark3

Mysql>drop table mark;

You might also like