When creating the SQL table, a 1064 error was encountered on line 6
P粉875565683
P粉875565683 2023-08-26 08:59:47
0
2
364
<p><pre class="brush:php;toolbar:false;">CREATE TABLE Customer( customer_id INT AUTO_INCREMENT PRIMARY KEY, customer_name VARCHAR(50) NOT NULL, customer_email VARCHAR(100) NULL, street_address VARCHAR(50) NULL, city ​​VARCHAR(50) NULL, province CHAR(2) NULL, postal_code CHAR(6) NULL, );</pre> <p>As mentioned above, when trying to create a new table, I encountered error 1064 and am not sure why. The name "city" is not a reserved word, and as far as I know the definition is not outdated. </p> <p><strong>#1064 - Your SQL syntax is incorrect; check the manual for your MySQL server version for the correct syntax to use near the ")" on line 6</strong>< /p>
P粉875565683
P粉875565683

reply all(2)
P粉818125805

can you try this

CREATE TABLE Customer(
    customer_id INT AUTO_INCREMENT PRIMARY KEY,
    customer_name VARCHAR(50) NOT NULL,
    customer_email VARCHAR(100) NULL,
    street_address VARCHAR(50) NULL,
    city VARCHAR(50) NULL,
    province CHAR(2) NULL,
    postal_code CHAR(6) NULL
);
P粉952365143

Remove the comma after postal_code

CREATE TABLE Customer(
customer_id INT AUTO_INCREMENT PRIMARY KEY,
customer_name VARCHAR(50) NOT NULL,
customer_email VARCHAR(100) NULL,
street_address VARCHAR(50) NULL,
city VARCHAR(50) NULL,
province CHAR(2) NULL,
postal_code CHAR(6) NULL
);
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!