How to show tables in MYSQL?

MYSQL is one of the popular Relational Database Management Systems out there. One of the basic commands that you start out with is to see the list of tables in a database. The command for achieving this is

show tables;

Sometimes when you enter that command in the MYSQL console, you might see a message that looks something like this

Screenshot (81)

The Error message states that no database is selected. The command would only work if we first select the database that we want to work on.

The command for selecting a database is-

use database_name;

where database_name is the Name of the Database.

Once you select the database, then the next step would be to execute the show tables command which would then show you the list of tables that exist within the database.


Screenshot (82)

As you can see the command now ran successfully. And it shows that I have two tables in the database-Harvest_Users and Table2.


Importing data to a MYSQL Database using PhpMyAdmin

If you are planning to Import data to a MySQL Database, the first thing which need to check is the whether your data is in the right format. MySQL is best compatible with files in the CSV format. So, in case you have an Excel file you could save that file as a CSV File and you don’t need a special software to do that. All you would have to do is click on File from the Menu and select Save As and make sure the Format Type is CSV.


Now once you have that checked off your list the next and final step is Importing this data to the MySQL Database. If you google this you would get many different explanations and ways which would make you confused. It might ask you to write SQL Queries which you totally don’t have to. If you are using PhpMyAdmin, the easiest and fastest way to do it is to use the Import Function in the menu. Saves you time creating a table and columns corresponding to the data.

Make sure you select the database, then click on the Import button, choose the file and format and Import!



Database Normalisation

This is an important concept one must know when dealing with databases. This is something which is quite often asked in Interviews.

Database  Normalization is a technique of decomposing data in a table. The main Intention to perform Normalization is to remove Data Redundancy and to ensure that there is uniqueness and consistency across the table.

By performing Normalization we resolve Issues of Insertion, Updation and Deletion. In case we have a table which is not Normalized, then there is a possibility that we might have two rows which are similar. And if we want to delete a particular row, Instead of performing one delete operation, we have to do it twice. This decreases the efficiency and multiplies the overhead cost. Since we are literally doubling the operations we perform.

In Order to overcome this, there are Normalization Rules available. And in case a table follows these rules, then the database can be called Normalized.

There are 4 major Normalization Rules-

  1. First Normal Form (1NF)
  2.  Second Normal Form (2NF)
  3. Third Normal Form (3NF)
  4.  Boyce and Codd Normal Form (BCNF)


These rules will be explained later!