Working with MySQL Tables - BunksAllowed

BunksAllowed is an effort to facilitate Self Learning process through the provision of quality tutorials.

Community

Working with MySQL Tables

Share This

In this tutorial first, we will create a table. To create a table, we have to understand data types. Here, the data types can be divided into three categories: Numeric, String, and Date-Time. If you want to create a table to store book information the SQL query can be written like the following:


The show tables command can be used to get a list of tables we have in this database. To get details about the attributes of the table, you can use desc table_name.


To alter the table you have created earlier, you can use alter table_name command. For example, if you want to add a new attribute for volume information, run the following command:


Let us add a dummy attribute to the books table.


Then, the newly added column needs to be deleted. You can run alter table command as shown below:


If you can drop a table, you can drop it by using drop table table_name command as shown below:


Happy Exploring!

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.