- 论坛徽章:
- 0
|
各位前辈们好,小弟在做mysql创建视图时,出现了一些困难,还请各位前辈们指点指点。
创建产品表:
create table product (
product_id int not null,
name varchar(50) not null,
price double not null
);
创建购买记录表:
create table purchase (
purchase_id int not null,
product_id int not null,
qty int not null,
gen_time not null
);
创建视图:
create view purchase_detail as select product.name as name, product.price as price, purchase.qty as qty, product.price * purchase.qty as total_value from product,purchase where product.product_id = purchase.product_id;
出现了如下的错误
上百度搜了一下,说1064是语法错误,我还是没有看出来,请各位前辈们指点。多谢! |
|