2016-10-05 16 views
-2

私は次の表を作成する際に間違いを知りませんでしたか?mysqlを使用してテーブルを作成する際にエラーが発生しましたか?

create table users(Time int(11) not NULL, 
      userid text,group text, 
      jobs_running int(11), 
      jobs_pending int(11), 
      job_limit int(11), 
      run_failures int(11), 
      queues text, 
      ATP int(11), 
      pend_reasons int(11)); 
+0

'group'はmysqlキーワードです。これをカラム名として使用しないでください –

答えて

1

これは、我々はいくつかのMySQLまたは任意のデータベース管理SYを使用する場合の一般的な問題と多くの時間が発生しています例えば、グループ、by、日付などのテーブルフィールド。 ここでは、テーブルフィールドに「グループ」という単語を使用しています。あなたはバックティック( `)する必要があります。以下の点に注意してください:

create table users(Time int(11) not NULL,userid text,`group` text,jobs_running int(11),jobs_pending int(11),job_limit int(11),run_failures int(11),queues text,ATP int(11),pend_reasons int(11)) 
1

列名グループの名前を他の名前に変更します。それはキーワードなのでエラーを出します。

これを試してください。ここで

create table users(Time int(11) not NULL, 
       userid text, 
       groups text, 
       jobs_running int(11), 
       jobs_pending int(11), 
       job_limit int(11), 
       run_failures int(11), 
       queues text, 
       ATP int(11), 
       pend_reasons int(11)); 
1

Mimer SQL-2003 Validatorが言ったことである。

create table users(Time int(11) not NULL,userid text,group text,jobs_running 
        ^----        ^--- 
int(11),jobs_pending int(11),job_limit int(11),run_failures int(11),queues 

text,ATP int(11),pend_reasons int(11)); 

syntax error: Time 
    correction: <identifier> 
syntax error: group 
    correction: <identifier> 
3

は単純な引用符を行うと、これはあなたのクエリの実行を行います、下記
あなたの列名を変更する必要がクエリを実行されていません 注

create table users(Time int(11) not NULL,userid text,`group` text,jobs_running int(11),jobs_pending int(11),job_limit int(11),run_failures int(11),queues text,ATP int(11),pend_reasons int(11)); 
関連する問題