不,您需要在创建表时使用像这样的打开和关闭括号()。使用以下语法-
CREATE TABLE IF NOT EXISTS yourTableName ( yourColumnName1 dataType1, . . . . . N );
让我们首先创建一个表-
mysql> CREATE TABLE IF NOT EXISTS DemoTable ( CustomerId int, CustomerName varchar(20), CustomerAge int , PRIMARY KEY(CustomerId) );
使用插入命令在表中插入一些记录-
mysql> insert into DemoTable values(1,'Chris',25); mysql> insert into DemoTable values(2,'Robert',34);
使用select语句显示表中的所有记录-
mysql> select *from DemoTable;
输出结果
+------------+--------------+-------------+ | CustomerId | CustomerName | CustomerAge | +------------+--------------+-------------+ | 1 | Chris | 25 | | 2 | Robert | 34 | +------------+--------------+-------------+ 2 rows in set (0.00 sec)