Help me to see what is wrong with this insert statement.
Source: Internet
Author: User
Let me see what is wrong with this insert statement? Run this statement insertintochinaipv4 (from, to) values ('1. 50.0.0 ', '1. 50.0000255 '); always prompt: ERROR1064 (42000): Youhavean help me to see what is wrong with this insert statement?
Execute this statement insert into chinaipv4 (from, to) values ('1. 50.0.0 ', '1. 50.0000255 ');
Always prompt:
ERROR 1064 (42000): 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 'from,
To) values ('1. 50.0.0 ', '1. 50.0000255') 'at line 1
The table structure is as follows:
+ ------- + ------------- + ------ + ----- + --------- + ---------------- +
| Field | Type | Null | Key | Default | Extra |
+ ------- + ------------- + ------ + ----- + --------- + ---------------- +
| Id | int (11) | NO | PRI | NULL | auto_increment |
| From | varchar (16) | YES | NULL |
| To | varchar (16) | YES | NULL |
+ ------- + ------------- + ------ + ----- + --------- + ---------------- +
------ Solution --------------------
For MySQL
Insert into 'chinaipv4 '('from', 'to') values ('1. 50.0.0', '1. 50.255.255 ');
------ Solution --------------------
From is a reserved mysql word, which must be escaped from'
------ Solution --------------------
Discussion
For MySQL
Insert into 'chinaipv4 '('from', 'to') values ('1. 50.0.0', '1. 50.255.255 ');
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.