针对actor表创建视图actor_name_view

题目描述

针对actor表创建视图actor_name_view,只包含first_name以及last_name两列,并对这两列重新命名,first_name为first_name_v,last_name修改为last_name_v:
CREATE TABLE IF NOT EXISTS actor (
actor_id smallint(5) NOT NULL PRIMARY KEY,
first_name varchar(45) NOT NULL,
last_name varchar(45) NOT NULL,
last_update timestamp NOT NULL DEFAULT (datetime('now','localtime')))
代码:
create view actor_name_view (first_name_v,last_name_v) as 
select first_name,last_name 
from actor
第一个as后面为子查询,而且子查询需要和视图中需要显示的部分相对应

猜你喜欢

转载自blog.csdn.net/neo233/article/details/80640421