免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1165 | 回复: 0
打印 上一主题 下一主题

关于merge表的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-04-28 22:24 |只看该作者 |倒序浏览
我在建立merge表时遇到了以下一些问题,
我先建立了两个表,如下:mysql>; create table sales_rep1(
    ->; id int auto_increment primary key,
    ->; employee_number int(11),
    ->; surname varchar(40),
    ->; first_name varchar(30),
    ->; commission tinyint(4),
    ->; date_joined date,
    ->; birthday date
    ->; ) type=myisam;
Query OK, 0 rows affected (0.11 sec)

mysql>; create table sales_rep2(
    ->; id int auto_increment primary key,
    ->; employee_number int(11),
    ->; surname varchar(30),
    ->; first_name varchar(30),
    ->; commission tinyint(4),
    ->; date_joined date,
    ->; birthday date,
    ->; time date) type=myisam;
Query OK, 0 rows affected (0.06 sec)

然后建立了merge表.


mysql>; create table sales_rep1_2(
    ->; id int auto_increment primary key,
    ->; employee_number int(11),
    ->; surname varchar(40),
    ->; first_name varchar(30),
    ->; commission tinyint(4),
    ->; date_joined date,
    ->; birthday date) type=merge union=(sales_rep1,sales_rep2);
Query OK, 0 rows affected (0.06 sec)
我试图往sales_rep1里添加数据,省去了id 列...但是出错了,不知道为什么.
mysql>; insert into sales_rep1 ('employee_number','surname','first_name','commission','date_joi
ned','birthday') values (
    ->; 1,'Tshwete','Paul',15,'1999-01-03','1970-03-04');
ERROR 1064: You have an error in your SQL syntax.  Check the manual that corresponds to your M
ySQL server version for the right syntax to use near ''employee_number','surname','first_name'
,'commission','date_joi

于是,我加上了id列,成功了.
mysql>; insert into sales_rep1 values(1,1,'Tshwete','Paul',15,'1999-01-03','1970-03-04');
Query OK, 1 row affected (0.02 sec)
然后我给sales_rep2添加了数据.
mysql>; insert into sales_rep2 values(1,2,'Grobler','Peggy-Sue',12,'2001-11-19','1956-08-25');
Query OK, 1 row affected (0.00 sec)
然后试图查看merge表的数据,但是无法打开,为什么呢?哪位高手帮忙看一下?
mysql>; select * from sales_rep1_2;
ERROR 1016: Can't open file: 'sales_rep1_2.MRG'. (errno: 143)
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP