我有两个mysql表
表A
col1 col2 SIM1 ..........col24
-----------------------------------
a x 1 5
b y 1 3
c z 0 2
d g 2 1
tableB的
colA colB SIM2
-------------------
x g 1
y f 0
x s 0
y e 2
我使用java使用jdbc连接到mysql数据库。
我需要索引两个表
string query1 = " CREATE INDEX ON TableA (SIM1) ";
string query2 = " CREATE INDEX ON TableB (SIM2) ";
当我使用excecuteUpdate(query1)和executeUpdate(query2)语句时,我收到以下错误
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 'ON TableA (SIM1)' at line 1
请建议。
答案 0 :(得分:4)
答案 1 :(得分:2)
我认为您错过了索引名称:CREATE INDEX IndexName ON ...
有关详细信息,请参阅命令参考:http://dev.mysql.com/doc/refman/5.0/en/create-index.html