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;  



UPDATE QUERY AND SELECT QUERY:
  • An update query is used to update the data in the table.
  • The select query returns all the data in the Students Table.
        SELECT * FROM Students;

        UPDATE Students SET age= 18 WHERE name = 'Vetri'



ALTER 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.



TRUNCATE TABLE:

    The TRUNCATE TABLE statement is used to delete the data inside a table, but not the table itself.

    TRUNCATE TABLE Students;




 Thanks for choosing our blog 😊. 
Will discuss an example of MySQL clauses in the next part. -  Part-3


Tutorial Topics for examples:
Database Creation -  Part-1
Table Modifications  -  Part-2
Clauses   - Part-3
Operators  - Part-4
Joins  - Part-5

Comments

Popular posts from this blog

MySQL Tutorial Part 1

Pandas DataFrame empty

Introduction to Java