某医院住院部设有病人关系R(住院号,姓名,性别,、科室号,病房,家庭住址),其中:“住院号”唯一标识关系R中的每一个元组。“性别”的取值只能为M或F;科室关系D(科室号,科室名,负责人,联系电话),其中:“科室号”唯—标识关系D中的每一个元组。创建R关系的SQL语句如下:CREATE TABLER(住院号CHAR(4)PRIMARY KEY,姓名CHAR(10),性别CHAR(1)__( )__科室号CHAR(4)__(请作答此空)__家庭住址CHAR(30));
- A.NOT NULL
- B.REFERENCES D(科室号)
- C.NOT NULL UNIQUE
- D.REFERENCES D(科室名)
正确答案及解析
正确答案
解析
创建表的基本语法:CREATE TABLE<表名>(<列名1><数据类型>[列级完整性约束条件][,···n])定义主键使用:PRIMARY KEY或PRIMARY KEY(列名)方式定义外键使用:REFERENCES表名(列)或FOREIGN KEY(列名)REFERENCES表名(列)方式定义自定义约束使用:CHECK(约束表达式)本题第1问是要对性别进行约束,所以需要使用check,由于性别为字符类型需要使用单引号。所以正确的选项应该为:D本题第2问,科室号关联到科室关系,在R关系中科室号应定义为外键,外键定义时应该关联到的是科室关系的科室号,所以正确的选项应为B
你可能感兴趣的试题
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
- 查看答案