Próbując nałożyć tworzenie indeksów w MySQL
ALTER TABLE 'forum_' ADD INDEX ('id_');
dostaje blad:
Cytat
#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 ''forum_' ADD INDEX (id_)' at line 1
Struktuta tabeli forum_
CREATE TABLE `forum_` (
`id` int(8) NOT NULL AUTO_INCREMENT,
`id_` int(8) NOT NULL DEFAULT '0',
`id_b` int(8) NOT NULL DEFAULT '0',
`status` int(8) NOT NULL DEFAULT '0',
`zablokowany` int(8) NOT NULL DEFAULT '0',
`autor` varchar(255) collate utf8_swedish_ci NOT NULL DEFAULT '',
`temat` text collate utf8_swedish_ci NOT NULL,
`opis` text collate utf8_swedish_ci NOT NULL,
`tresc` text collate utf8_swedish_ci NOT NULL,
`odslony` int(8) NOT NULL DEFAULT '0',
`nowy_temat` int(8) NOT NULL DEFAULT '0',
`ostatni_post` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`ikona` int(255) NOT NULL DEFAULT '0',
`data_dodania` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`data_edycji` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`ip_autora` varchar(30) collate utf8_swedish_ci NOT NULL DEFAULT '',
`html` int(8) NOT NULL DEFAULT '0',
`xcode` int(8) NOT NULL DEFAULT '0',
`emoikony` int(8) NOT NULL DEFAULT '0',
`ip` varchar(50) collate utf8_swedish_ci NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=20655 DEFAULT CHARSET=utf8 COLLATE=utf8_swedish_ci AUTO_INCREMENT=20655 ;
co robie zle ?
w bazie juz sa rekordy.
a jak daje
ALTER TABLE `forum_c` ADD INDEX `in` ( `id_` ( 8 ) )
dostaje
Cytat
#1089 - Incorrect sub part key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique sub keys