标签:
create table Fruit_main ( Name varchar(20) primary key not null, Code varchar(10) not null, Chandi varchar(20), Jiage numeric(4,2) ) create table Fruit_two ( FmCode varchar(10) not null, FtCode varchar(10) not null, ShowMessage varchar(200), ) select* from Fruit_main,Fruit_two insert into Fruit_main values(‘苹果‘,‘Fr001‘,‘沂源‘,‘1.25‘) insert into Fruit_main values(‘柠檬‘,‘Fr002‘,‘不详‘,‘1.50‘) insert into Fruit_two values(‘Fr001‘,‘Ap001‘,‘好吃!‘) insert into Fruit_two values(‘Fr001‘,‘Ap002‘,‘好脆!‘) insert into Fruit_two values(‘Fr002‘,‘Nm001‘,‘好酸!‘) insert into Fruit_two values(‘Fr002‘,‘Nm002‘,‘VC多!‘) --新建一个视图 1 create view Fruit_show as select Name,Chandi,Jiage,ShowMessage from Fruit_main a,Fruit_two b where a.Code=b.FmCode and a.Name=‘苹果‘ --2 create view Fruit_show1 as select Name,Chandi,Jiage,ShowMessage from Fruit_main a,Fruit_two b where a.Code=b.FmCode select * from Fruit_show1 select * from Fruit_show
标签:
原文地址:http://www.cnblogs.com/zhizhuo-1991/p/5341403.html