某工程项目公司的信息管理系统的部分关系模拟式如下:职工(职工编号,姓名,性别,居住城市)项目(项目编号,项目名称,状态,城市,负责人编号)职工项目(职工编号,项目编号)其中:(1)一个职工可以同时参与多个项目,一个项目需要多个职工参与。(2)职工的居住城市与项目所在城市来自同一个域。(3)每个项目必须有负责人,且负责人为职工关系中的成员。(4)项目状态有两个:0表示未完成,1表示已完成。
【问题1】下面是创建职工关系的SQL语句,职工编号唯一标识一个职工,职工姓名不能为空。请讲空缺部分补充完整。CREATE TABLE 职工(职工编号 CHAR(6),姓名 CHAR(8)①,性别 CHAR(2),居住城市 VARCHAR(20),PRIMARY KEY②);
【问题2】下面是创建项目关系的SQL语句,请实习相关的完整性约束。CREATE TABLE 项目(项目编号 CHAR(6),项目名称 VARCHAR(20),状态 CHAR(1) CHECK③,城市 VARCHAR(20),负责人编号 CHAR(6)④,FOREIGN KEY⑤ REFERENCES⑥);
【问题3】请完成下列查询的SQL语句。(1)查询至少参加两个项目的职工编号和参与的项目数SELECT 职工编号,⑦,FROM 职工项目GROUP BY⑧,HAVING⑨;(2)查询参与居住城市正在进行的工程项目的职工工号和姓名。SELECT 职工.职工编号,姓名FROM 职工,职工项目,项目WHERE职工.职工编号=职工项目.职工编号 AND 项目.项目编号=职工项目.项目编号AND⑩ AND11假设项目编号为P001的项目负责人李强(其用户名为U1)有对参与该项目的职工进行查询的权限。下面是建立视图emp和进行授权的SQL语句,请将空缺部分补充完整。(1)CREATE VIEW 12AS SELECT 职工编号,姓名,性别,城市FROM 职工WHERE 职工编号IN (SELECT 13FROM 职工项目WHERE 14WITH CHECK OPTION;GRANT 15 ON emp TO U1)
正确答案及解析
正确答案
解析
本题考查SQL语言相关知识
1、①NOT NULL②(职工编号)
2、③(状态 IN(‘0’,‘1’))④NOT NULL⑤负责人编号⑥职工(职工编号)
3、⑦COUNT(项目编号)⑧职工编号⑨COUNT(项目编号)>=2⑩职工.居住城市=项目.城市。11项目.状态=‘0’。12emp。13职工编号。14项目编号=’P001’。15SELECT
你可能感兴趣的试题
Advancements in ( )have contributed to the growth of the automotive industry through the creation and evolution of self-driving vehicles.
-
- A.Artificial Intelligence
- B.Cloud Computing
- C.Internet of Things
- D.Big Data
- 查看答案
In project human resource management , ( )is not a source of power for the project manager.
-
- A.referent power
- B.expert power
- C.reward power
- D.audit power
- 查看答案
At the project establishment stage , the feasibility study mainly includes techinical feasibility analysis , ( ), operation environment feasibility analysis and other aspects of feasibility analysis.
-
- A.detail feasibility analysis
- B.opportunity analysis
- C.economic feasibility analysis
- D.risk analysis
- 查看答案
( )is a grid that shows the project resources assigned to each work package.
-
- A.Stakeholder engagement assessment matrix
- B.Requirements traceability matrix
- C.Probability and impact matrix
- D.Responsibility assignment matrix
- 查看答案
Xinhua News Agency reported in January 2022,Chian will further promote the developmet of a digital economy during the 14th Five-Year Plan eriod(2021-2025). The plan also emphasized industrial ( )transformation.
-
- A.digital
- B.networking
- C.intelligentize
- D.informatization
- 查看答案