Home > database >  Mysql it encountered a problem
Mysql it encountered a problem

Time:04-07

1. Build a table first, normal can build
Mysql> The create table course (
-> Course_no char (6) the not null primary key
-> );
Query OK, 0 rows affected

2. Delete the
Mysql> Drop table course;
Query OK, 0 rows affected

Build table 3. The approach of the first step, but an error
Mysql> The create table course (
-> Course_no char (6) the not null primary key
-> );
1064 - You have an error in your SQL syntax; Check the manual that corresponds to your MySQL server version for the right syntax to use near '- & gt; Course_no char (6) the not null primary key
-> ) 'at line 2

4. Put the not null and the order of the primary key exchange, the result can
Mysql> The create table course (
-> Course_no char (6) primary key not null
-> );
Query OK, 0 rows affected

This is why???????

CodePudding user response:

Grammar question,
First key value type declaration, then is whether the value is empty definition,

This have what not understand

CodePudding user response:

Mysql8.0 measured, didn't met your error and success for the first time, according to the reason to use the same statement create after deletion, will be successful;
  • Related