2、数据操作:
a) 使用嵌套查询实现。查询“喜来乐综合服务有限公司”的项目负责人,并输出项
目经理基本信息,如下图:
名字性别电话项目编号陈续源158 A-3076
b) 创建视图用于实现查询完成项目开始时间在2020-1-1到2022-1-1之间的项
目信息,视图的名称规定为“project_info”,需要展示的信息如下:
名字电话项目名字李四185*****6 1587*****7
开始时间
客户2022-03-01 xx科技有限公司c 对项目经理信息表进行索引设置。请用代码实现将phone字段设置为普通索引。
要求:索引名称设置为index_phone。
#2a
SELECT manager.uname,manager.sex,manager.phone,manager.Project_id FROM manager WHERE manager.Project_id in (SELECT project_id FROM project WHERE project.company='喜来乐综合服务有限公司')
#2b
CREATE VIEW project_info AS
SELECT m.uname, m.phone, m.Project_id, p.begin_time,p.company FROM manager m,project p WHERE m.Project_id=p.project_id AND begin_time BETWEEN '2020-01-01' AND '2022-01-01';
#2c
CREATE INDEX index_phone ON manager(phone);
#2a
SELECT manager.uname,manager.sex,manager.phone,manager.Project_id FROM manager WHERE manager.Project_id in (SELECT project_id FROM project WHERE project.company='喜来乐综合服务有限公司')
#2b
CREATE VIEW project_info AS
SELECT m.uname, m.phone, m.Project_id, p.begin_time,p.company FROM manager m,project p WHERE m.Project_id=p.project_id AND begin_time BETWEEN '2020-01-01' AND '2022-01-01';
#2c
CREATE INDEX index_phone ON manager(phone);