红联Linux门户
Linux帮助

mysql 中 视图 更新 出错 ! 求救

发布时间:2011-11-17 22:04:19来源:红联作者:linuxydy
这是我的学生表
mysql> create table Student
(Sno char(9) primary key,
/*列级完整性约束,Sno是主键,char(n) 是长度为n的定长字符串,
varchar(n) 最大长度为n的变长字符串*/
Sname char(8) unique,/*Sname 取唯一值*/
Ssex char(4),/*男或者女 各占两个字节*/
Sage smallint,
Sdept char(4));
mysql> describe Student;

这是我定义的视图
create view IS_Student
as
select Sno,Sname,Sage
from Student
where Sdept='IS'
with check option;
我要在视图中插入一个元组
mysql> insert
-> into IS_Student
-> values('200815129','陈静','20');
Query OK, 1 row affected (0.00 sec)

mysql> select * from IS_Student;
+-----------+--------+------+
| Sno | Sname | Sage |
+-----------+--------+------+
| 200815126 | 赵云 | 18 |
| 200815125 | 张立 | 19 |
+-----------+--------+------+
2 rows in set (0.00 sec)


这个时候 出错了 IS_Student 视图中 没有 我插入的元组
而student 表中 则 显示 如下 怎么办啊 很着急啊
mysql> select * from Student;
+-----------+--------+------+------+-------+
| Sno | Sname | Ssex | Sage | Sdept |
+-----------+--------+------+------+-------+
| 200815129 | 陈静 | NULL | 20 | NULL |
文章评论

共有 0 条评论