页次: 1
创建数据表,
mysql> create table goods ( -> g_id int not null auto_increment primary key comment "商品的编码", -> g_name char(20) comment "商品的名字", -> v_id int not null comment "供应商id", -> g_price decimal (6,2) comment "价格" -> ); Query OK, 0 rows affected (0.22 sec)
插入数据
mysql> insert into goods ( g_name, v_id, g_price )values -> ('aaa', 1, 1.1), -> ('aaa', 2, 2.1), -> ('aaa', 3, 3.1), -> ('bbb', 1, 4.1), -> ('bbb', 2, 5.1), -> ('bbb', 3, 6.1), -> ('ccc', 1, 7.1), -> ('ccc', 2, 8.1), -> ('ccc', 3, 9.1); Query OK, 9 rows affected (0.04 sec) Records: 9 Duplicates: 0 Warnings: 0
现在存在的内容是
mysql> select * from goods; +------+--------+------+---------+ | g_id | g_name | v_id | g_price | +------+--------+------+---------+ | 1 | aaa | 1 | 1.10 | | 2 | aaa | 2 | 2.10 | | 3 | aaa | 3 | 3.10 | | 4 | bbb | 1 | 4.10 | | 5 | bbb | 2 | 5.10 | | 6 | bbb | 3 | 6.10 | | 7 | ccc | 1 | 7.10 | | 8 | ccc | 2 | 8.10 | | 9 | ccc | 3 | 9.10 | +------+--------+------+---------+ 9 rows in set (0.00 sec)
ipbbs.net
离线
页次: 1