Creating a Table
Operations
A MySQL data table consists of basic information, field/column information, virtual columns, indexes, and foreign keys. The virtual columns, indexes, and foreign keys are optional and can be configured based on service requirements.
Procedure
- On the top menu bar, choose Database Management. On the displayed Objects page, select Tables and click Create Table. Figure 1 Creating a table
- On the displayed page, specify the details under Basic Information (Table Name is mandatory). Click Next, as shown in the following figure. Figure 2 Basic Information
- Set the following fields based on the service requirements: table column name, field type, length, nullable, primary key, and extended information.
- If you do not need to add virtual columns, indexes, or foreign keys, click Create at the bottom of the page. In the displayed SQL Preview dialog box, click Execute. Figure 3 Configuring field information
- Only MySQL 5.6.5 and later support default DATETIME values.
- In versions earlier than MySQL 5.6.5, leave default values blank. Otherwise, an error occurs.
- If you need to add virtual columns, indexes, and foreign keys, click Next. Then, set the column name, type, length, nullable, primary key, expression, storage type, comment, and extended information. If you need to set the table index or foreign key, click Next. After the setting, click Create.
Figure 4 (Optional) Adding virtual columns
Figure 5 (Optional) Adding indexes
Figure 6 (Optional) Adding foreign keys
When you create a foreign key, the type of columns in the referenced table must be the same as that of included columns, and must be the primary key or have a unique index.
- If you do not need to add virtual columns, indexes, or foreign keys, click Create at the bottom of the page. In the displayed SQL Preview dialog box, click Execute.
- In the SQL Preview dialog box, click Execute to create a table.
Last Article: Table Management
Next Article: Opening a Table
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.