数据库SQL实战题:针对actor表创建视图actor_name_view(教程)
程序员文章站
2022-05-01 18:24:57
针对actor表创建视图actor_name_view,只包含first_name以及last_name两列,并对这两列重新命名,first_name为first_name_v,l...
针对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 view_name (字段名1,字段名2) as select .... from ...
答案
create view actor_name_view (first_name_v,last_name_v) as select first_name,last_name from actor