mysql数据库中如何定义属性

gkfeng 发布于 2012/06/08 07:59
阅读 1K+
收藏 0

Enter password: ****
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.0.22-community-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.


mysql> create database book;
Query OK, 1 row affected (0.03 sec)


mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| book               |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.06 sec)

mysql> use book;
Database changed
mysql> create table bookinfo(id int(10) unsigned not null auto_increment,booknam
e varchar(45) not null default",author varchar(45) not null default",price float
not null default 0,primary key(id))engine InnoDB default charset=gb2312;
ERROR 1064 (42000): 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 'float
not null default 0,primary key(id))engine InnoDB default charset=gb2312' at line
 1
请帮忙指正

加载中
0
鉴客
鉴客
试了你的那个建表语句,是OK的,不过注意一下里面有一些没空格隔开
create table bookinfo(
    id int(10) unsigned not null auto_increment,
    bookname varchar(45) not null default",
    author varchar(45) not null default",
    price float not null default 0,
    primary key(id)
) 
engine InnoDB default charset=gb2312;
0
leo108
leo108
估计楼主没装 InnoDB引擎
返回顶部
顶部