单选题Table TAB1 was created using the following statement: CREATE TABLE tab1 (c1 INT, c2 INT, c3 INT, c4 INT, c5 INT); If column C1 is unique and queries typically access columns C1 and C2 together, which statement(s) will create index(es) that will provide

题目
单选题
Table TAB1 was created using the following statement: CREATE TABLE tab1 (c1 INT, c2 INT, c3 INT, c4 INT, c5 INT); If column C1 is unique and queries typically access columns C1 and C2 together, which statement(s) will create index(es) that will provide optimal query performance? ()
A

 CREATE UNIQUE INDEX xtab1 ON tab1 (c1) include (c2)

B

 CREATE UNIQUE INDEX xtab1 ON tab1 (c1);  CREATE INDEX xtab2 ON tab1 (c3) INCLUDE (c2) 

C

 CREATE UNIQUE INDEX xtab1 ON tab1 (c2, c1)

D

 CREATE UNIQUE INDEX xtab1 ON tab1 (c2) INCLUDE (c1)

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

Examine the structure of the STUDENTS table:You need to create a report of the 10 students who achieved the highest ranking in the course INT SQL and who completed the course in the year 1999.Which SQL statement accomplishes this task?()

A.

B.

C.

D.


参考答案:D

第2题:

以下选项中能正确把c1定义成结构体变量的是( )。

A.typedef struct { int red; int red; int green; int blue; }COLOR; COLOR c1;

B.struct color c1 { int red int red; int green int blue; };

C.stmctcolor { int red, int green; int blue; }c1;

D.struct { int red; int green; int blue; }c1;


正确答案:D
解析:因为结构体中不能出现同名的成员变量,所以选项A和B都是错误的;又因为结构体中成员的定义应该由分号隔开,所以选项C也是错误的。选项D定义了一个无名结构体,并同时定义该结构体变量c1,是正确的写法。故应该选择D。

第3题:

执行下列语句后,c3中的值为【 】

int c1=1,c2=2,c3;c3=1.0/c2 * c1;


正确答案:×
0 解析:在赋值运算中,如果表达式中变量和常量的数据类型不一致就会自动进行类型转换。系统会计算1.0/c2,由于1.0是实型,所以均先转化为双精度型0.500000,再与 c1转化后的双精度数相乘得0.500000。但其要赋值给整型变量c3,故要进行强制转换,得c3的值为0。

第4题:

Given the following DDL for the PARTS table:CREATE TABLE parts (part_no INT(9) NOT NULL, part_name VARCHAR(24), part_remain INT(9));All part numbers entered will be different and all rows should be displayed in order of increasing part numbers whenever the table is queried. Which of the following create index statements will meet this criteria and require the least amount of storage for the index object?()

A.CREATE UNIQUE INDEX idx_partno ON parts(part_no)

B.CREATE UNIQUE INDEX idx_partno ON parts(part_name ASC)

C.CREATE UNIQUE INDEX idx_partno ON parts(part_name, part_no ASC)

D.CREATE UNIQUE INDEX idx_partno ON parts(part_no, part_name ASC)


参考答案:A

第5题:

An application needs a table for each connection that tracks the ID and Name of all items previously ordered and committed within the connection. The table also needs to be cleaned up and automatically removed each time a connection is ended. Assuming the ITEMS table was created with the following SQL statement:CREATE TABLE items item_no INT, item_name CHAR(5), item_qty INT)Which of the following SQL statements will provide the table definition that meets the specified requirements?()

A.DECLARE GLOBAL TEMPORARY TABLE tracker AS (SELECT item_no, item_name FROM items) WITH NO DATA ON COMMIT PRESERVE ROWS ON DISCONNECT DROP TABLE

B.DECLARE GLOBAL TEMPORARY TABLE tracker AS (SELECT item_no, item_name FROM items) WITH NO DATA ON COMMIT PRESERVE ROWS

C.CREATE TABLE systmp.tracker AS (SELECT item_num, item_name FROM items) WITH NO DATA ON COMMIT PRESERVE ROWS

D.CREATE TABLE tracker AS (SELECT item_num, item_name FROM items) ON COMMIT PRESERVE ROWS ON DISCONNECT DROP TABLE


参考答案:B

第6题:

若有以下程序段: int c1=1,c2=2,c3: c3=c1/c2:

A.0

B.1/2

C.0.5

D.1


正确答案:A
cl和c2都是整数,1/2取整得0,舍弃小数点。因此正确答案为A。

第7题:

建立一个学生信息表student,要求它由学号sno、姓名sname、性别sex、年龄age4个属性组成,其学号属性唯一,学号、姓名字段不能为空。下列语句正确的是

A.CREATE TABLE student(sno char(5) NOT NULL sname char(8) NOT NULL sex char(1) age int);

B.CREATE TABLE student (sno char(5) NOT NULL UNIQUE sname char(8) sex char(1) age int);

C.CREATE TABLE (sno char(5) NOT NULL UNIQUE sname char(8) NOT NULL sex char(1) age int);

D.CREATE TABLE student (sno char(5) NOT NULL UNIQUE sname char(8) NOT NULL sex char(1) age int);


正确答案:D
解析:A) 选项中,创建sno字段没有唯一性限制;B) 选项中,创建sname字段没有不为空的限制; C) 选项中,创建表没有表明。

第8题:

以下选项中不能正确把c1定义成结构体变量的是

A.typedef struct {int red: int green: int blue; } COLOR; COLOR c1;

B.struct color c1 {int red int green: int blue; };

C.struct color {int red , int green : int blue : )cl;

D.struct {int red; int green; int blue } c1 ;


正确答案:B
解析:本题考核的知识点是结构体类型定义。结构体类型的定义格式为:strcut结构体名{成虽说明列表};结构体变量的定义有3种形式:第一种,定义结构体型的同时定义结构体变量,如:strcut结构体名{成员说明列表}变量;选项C属于这种情况,故选项C正确:第二种,先定义一个结构体类型,然后使用该类型来定义结构体变量,如:strcutstudent{成员说明列表}:student变量;选项A属于这种情况,故选项A正确;第三种,定义一个无名称的结构体类型的同时定义结构体变量,如:strcutstudent{成员说明列表}变量;选项D属于这种情况,故选项D正确.所以,4个选项中选项B符合题意。

第9题:

Given the following statements:CREATE TABLE tab1 (col1 INT); CREATE TABLE tab2 (col1 INT); CREATE TRIGGER trig1 AFTER UPDATE ON tab1 REFERENCING NEW AS new1 FOR EACH ROW MODE DB2SQL INSERT INTO tab2 VALUES(new1.col1); INSERT INTO tab1 VALUES(2),(3);What is the result of the following query? SELECT count(*) FROM tab2;()

A.3

B.2

C.1

D.0


参考答案:D

第10题:

TableTAB1wascreatedusingthefollowingstatement:CREATETABLEtab1(c1INT,c2INT,c3INT,c4INT,c5INT);IfcolumnC1isuniqueandqueriestypicallyaccesscolumnsC1andC2together,whichstatement(s)willcreateindex(es)thatwillprovideoptimalqueryperformance?()

A.CREATEUNIQUEINDEXxtab1ONtab1(c1)include(c2)

B.CREATEUNIQUEINDEXxtab1ONtab1(c1);CREATEINDEXxtab2ONtab1(c3)INCLUDE(c2)

C.CREATEUNIQUEINDEXxtab1ONtab1(c2,c1)

D.CREATEUNIQUEINDEXxtab1ONtab1(c2)INCLUDE(c1)


参考答案:A

更多相关问题