Student database using MySQL Part 2
EXAMPLE FOR MYSQL TABLE MODIFICATIONS
Will work with an example to modify the table structure.
DESCRIBE TABLE:
The Describe statement is used to describe the structure of the table.
DESCRIBE Students;
- An update query is used to update the data in the table.
- The select query returns all the data in the Students Table.
Alter statement is used to modify the table structure.
ALTER TABLE Students ADD DateOfBirth date;
ALTER TABLE Students MODIFY COLUMN DateOfBirth year;
ALTER TABLE Students DROP COLUMN DateOfBirth;
DELETE TABLE:
DELETE FROM Students WHERE district='Coimbatore';
This query deletes the records from the Students table where the district is Coimbatore.
The TRUNCATE TABLE statement is used to delete the data inside a table, but not the table itself.
TRUNCATE TABLE Students;
Comments
Post a Comment