The CREATE command is a DDL command used to create a table or database. The syntax for creating tables and databases using the CREATE command is as follows -
Syntax for creating a database-
Create database database-name;
mysql> Create database query; Query OK, 1 row affected (0.04 sec)
In the above example, we created a file named " query" database.
Syntax for creating table -
Create table table-name( column-name1 datatype1, column-name2 datatype2, column-name3 datatype3, column-name4 datatype4 ------------------------------);
mysql> Create table Employee(Id INT, Name Varchar(20)); Query OK, 0 rows affected (0.19 sec)
In the above example, we have created a table named "Employee" which contains "Id" and "Name" two columns.
The above is the detailed content of What is the MySQL CREATE command? How can we create database and table at the same time using this command?. For more information, please follow other related articles on the PHP Chinese website!