#
Create a Table
This tutorial explains you how to create a table into MySQL database (schema).
In MySQL, physically, a schema is synonymous with a database. You can substitute the keyword SCHEMA instead of DATABASE in MySQL SQL syntax, for example using CREATE SCHEMA instead of CREATE DATABASE.
When you create a table into a MySQL schema, you can consider that you create a table into a specific database.
In my case I will create a table into the "X" database (schema).
If you want to create the table using the MySQL Workbench, here are the steps:
Connect to the MySQL Workbench, and right click on the schema where you want to create that table:
Choose the "Crete Table ..." and you will see the following screen:
Enter the table name, the character set used by this table, the columns and the column types. You can add indexes, foreign keys, triggers, partitions. When all is done, click on "Apply" and you will see the following screen:
You see the SQL Script for creating that table. Click on "Apply" in order to create that table.
SQL script was successfully applied to MySQL database. You can click on "Finish" to exit that window.
In the picture above you can see how you can create the SQL statement for creating the script for that table.
Here is the code for creating this table in MySQL:
CREATE TABLE `table1` (
`Column1` int(11) NOT NULL,
`Column2` varchar(45) DEFAULT NULL,
PRIMARY KEY (`Column1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;