前面已经create database hibernate;
       use hibernate; 
现在是建表
create table login
(
  'id' int(11) not null auto_increment,
  'name' varchar(100) default not null,
  'password' varchar(100) default not null,
  primary key ('id')
)
type=mysiam;出现的问题是:
       
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 ''id' int(11) not null auto_increment,
  'name' varchar(100) default not null,
' at line 3不知道错哪了,请给我个答案,谢谢,刚开始自学mysql

解决方案 »

  1.   

    'id' int(11) not null auto_increment, ->
    id int auto_incremen
      

  2.   

    CREATE TABLE `login` (
    `id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
    `name` VARCHAR( 100 ) NOT NULL ,
    `password` VARCHAR( 100 ) NOT NULL ,
    PRIMARY KEY ( `id` ) 
    ) 没查出来哪里错了,在phpmyadmin里运行楼主的语句确实错了,然后自己写了上面的就对了,你就用上面的吧
      

  3.   

    create table login
    (
      'id' int not null auto_increment,
      'name' varchar(100) default '123' not null,
      'password' varchar(100) default '456' not null,
      primary key ('id')
    )
    type=mysiam; 
      

  4.   

    LZ的语句有三处错误:
    1. DEFAULT 要有默认值。
    2. 从copy你的代码来看,你所使用的单引号不是 半角英文。
    3. 最后制定数据库引擎的时候写错了 type=mysiam; 因该是 MyISAM.
      

  5.   

    可是我明明按书上打的,也没有写默认值。上次好像是成功了 ,可能半角全角没写好,但不一定要在default里面写值吧。??谢谢各位
      

  6.   

      If strict SQL mode is not enabled, MySQL sets the column to the implicit default value for the column data type.
      If strict mode is enabled, an error occurs for transactional tables and the statement is rolled back. For non-transactional tables, an error occurs, but if this happens for the second or subsequent row of a multiple-row statement, the preceding rows will have been inserted.
      如果没有启用严格SQL模式,则MYSQL将赋给没有指定VALUE的DEFAULT列一个相应数据类型的默认值 即NULL。但是你的语句中DEFAULT 并且 NOT NULL,所以MYSQL将无法给此列赋予DEFAULT值。
      

  7.   

    无语create table login
    (
      `id` int(11) not null auto_increment,
      `name` varchar(100) default '' not null,
      `password` varchar(100) default '' not null,
      primary key (`id`)
    )
    type=myisam; 
      

  8.   

    11楼的大哥写的是对的..SICTxK很热心。谢谢了。
      

  9.   

    是我自己写的时候把default  '' 写成了default '' not null 了。XICK的我比较满意...