2016-07-25 14 views
-2

phpmyadminでSQLデータベースをインポートしようとしましたが、 エラーが表示されます。 閉じ括弧が必要です。phpmyadminのエラー終了括弧が必要です。 (near ")"

SQLクエリ)の位置194で(近い ")":

CREATE TABLE IF NOT EXISTS `wll_product` (`product_id` int(5) NOT NULL AUTO_INCREMENT, `product_name` varchar(60) NOT NULL, `product_type` tinyint(1) UNSIGNED NOT NULL DEFAULT '0'COMMENT) 

私は、MySQLへの新たなんだ、おかげで私を助けてください。

答えて

0

を持って あなたは(COMMENTキーワードの後に​​コメントを追加する必要がありますまたはコメントを残す)。また、auto_incrementを使用する場合は、product_idキーを作成する必要があります。

CREATE TABLE `wll_product` (
`product_id` int(5) NOT NULL AUTO_INCREMENT, 
`product_name` varchar(60) NOT NULL, 
`product_type` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'a comment', 
KEY (`product_id`) 
) ENGINE=InnoDB DEFAULT CHARSET=latin1 

編集:scaisEdgeが述べたように、私が以前言ったように、キーだけで十分で、pkではありません。

+0

ありがとうございました。最後に ';'を追加するだけでした。ありがとう:) –

0

あなたは、いくつかのエラーを持っているtinyint型が数値であるが、あなたは、文字列を割り当てられた「0」(自動インクリメント上必須)コメントキーを保留し、行方不明

CREATE TABLE IF NOT EXISTS `wll_product` ( 
    `product_id` int(5) NOT NULL AUTO_INCREMENT, 
    `product_name` varchar(60) NOT NULL, 
    `product_type` tinyint(1) UNSIGNED NOT NULL DEFAULT 0, 
    key(product_id) 
); 
-1
CREATE TABLE 'data' (
    'id' int(11) NOT NULL auto_increment, 
    'title' varchar(255) NOT NULL, 
    'text' text NOT NULL, 
    PRIMARY KEY ('id') 
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; 

INSERT INTO 'data' ('id', 'title', 'text') VALUES(1, 'Hello World!', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla 
sapien eros, lacinia eu, consectetur vel, dignissim et, massa. Praesent suscipit nunc vitae neque. Duis a ipsum. Nunc a erat. Praesent 
nec libero. Phasellus lobortis, velit sed pharetra imperdiet, justo ipsum facilisis arcu, in eleifend elit nulla sit amet tellus. 
Pellentesque molestie dui lacinia nulla. Sed vitae arcu at nisl sodales ultricies. Etiam mi ligula, consequat eget, elementum sed, 
vulputate in, augue. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;'); 
関連する問題