Working with MySQL Tables - BunksAllowed

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

Community

demo-image

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:

create_table_books

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.

desc_table_books

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:

alter_table_books

Let us add a dummy attribute to the books table.

alter_table_books_dummy_attr_add

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

alter_table_books_dummy_attr_drop

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

drop_table_books

Happy Exploring!

Comment Using!!

No comments:

Post a Comment

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