Creating a Table
You have logged in to the DAS console.
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.
- On the top menu bar, choose Database Management. On the displayed page, click Create Table.
- On the displayed tab, specify the required parameters. The table name is mandatory. Click Next.
- 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.
- MySQL 5.6.5 and later versions support the default value of datetime.
- In MySQL 5.6.5 and earlier versions, the default value of datetime is not supported. You can leave the value 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.
When you create a foreign key, the type of the 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.
- In the SQL Preview dialog box, click Execute to create a table.