MySQL CREATE TABLE AS: Syntax, Examples, and Best Practices
CREATE TABLE table_name ( column1 datatype, column2 datatype, column3 datatype, .... );
Example:
CREATE TABLE employees ( id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, first_name VARCHAR(30) NOT NULL, last_name VARCHAR(30) NOT NULL, email VARCHAR(50) NOT NULL, hire_date DATE NOT NULL, salary FLOAT(10,2) NOT NULL );
This command creates a table named 'employees' with columns id, first_name, last_name, email, hire_date, and salary. The id column is automatically generated and serves as the primary key. The other columns have specified data types and constraints.
原文地址: https://www.cveoy.top/t/topic/lvEX 著作权归作者所有。请勿转载和采集!