Create tables MySQL Essential Training

Create tables MySQL Essential Training

MySQL

Create tables MySQL Essential Training




Hey folks, welcome to another effective lesson in MySQL Essential Training series. In this Create tables MySQL Essential Training lesson we are going to learn the basics in how to create a tables in the mysql command prompt. Today’s trending technological world the technology is grow day by day. We’ve so many options to do a particular work.
So far in our previous lesson we’ve learned how to create a database and show the existing databases. Here first we see the another method to open the mysql command line interface. We’re sure you’re using xampp to run the PHP and mysql. If not, you’re using the mysql alone, then you can follow the method we explain in our previous lesson to execute mysql CLI(Command Line Interface).
Create tables MySQL Essential Training
Open your xampp control panel shown in like the above image. It’ll actually gives you an plenty of options to control local server, MySQL, FTP and etc. In that click the shell button at the right side of the wizard. It’ll launches the MySQL CLI in your system.
Create tables MySQL Essential Training
In that we can give the user name and password to get into the CLI to access our databases and tables. Here we don’t give any passwords while we’re install the Xampp, so we don’t use them at here. After enter these at information at the beginning it’ll brings us into the power of accessing the collection of databases.
In the last lesson of our series we’ve seen how to create a database and show them. After that we have plenty of databases to access. From those list of databases we wants to use a particular database, to do that in the name itself the command use database is available.
// Take control of a particular database to insert or access data
Syntax: use database_name;
Example

Create tables MySQL Essential Training
After enter this command is executed there is nothing happened or affect the database. The CLI just tells the query compiler, “Hey here a database named sample is ready to use”. And now we have full control database named “sample”, among the large list of databases.
Finally get into the particular database we want to insert a data, like we already mention in our previous lesson database is like a container. It contains a lot of tables to store the data inside the database. So store at least a single value we wants to Create tables MySQL Essential Training in this section.




// Create a simple table named Emp_details under the database named sample
Syntax: create table table_name(column_name1 data_type(size_of_column),…, column_namen data_type(size_of_column);)
Consider the following example and check with our syntax to create a table.
Create tables MySQL Essential Training
In the above creation of table example we’ve created table named emp_details with various column names.

After execute a command in the mysql CLI we wants to know whether the table is created or not. We can use the command like show databases

Create tables MySQL Essential Training
The above command will shows the exactly available tables inside the database named sample. In particularly we wants to show the table structure, like how the table is formed inside the mysql. We can use the command describe tables to view the structure of the table.

Create tables MySQL Essential Training
We now create a table and in the next lesson we can learn how to insert a data inside the tables. We hope this lesson will helps you a lot to know the basics of how to create a table in mysql.




Leave a Reply