Given the following DDL and INSERT statements: CREATE VIEW v1 AS SELECT col1 FROM t1 WHERE col1 > 10; CREATE VIEW v2 AS SELECT col1 FROM v1 WITH CASCADED CHECK OPTION; CREATE VIEW v3 AS SELECT col1 FROM v2 WHERE col1 < 100; INSERT INTO v1 VALUES(5); INSERT INTO v2 VALUES(5); INSERT INTO v3 VALUES(20); INSERT INTO v3 VALUES(100); How many of these INSERT statements will be successful?()
第1题:
根据 “ 歌手 ” 表建立视图 myview, 视图中含有包括了 “ 歌手号 ” 左边第一位是 “ 1 ” 的所有记录,正确的 SQL 语句是
A)CREATE VIEW myview AS SELECT * FROM 歌手 WHERE LEFT( 歌手号 ,1)="1"
B)CREATE VIEW myview AS SELECT * FROM 歌手 WHERE LIKE("1" , 歌手号 )
C)CREATE VIEW myview SELECT * FROM 歌手 WHERE LEFT( 歌手号 ,1)="1"
D)CREATE VIEW myview SELECT * FROM 歌手 WHERE LIKE("1" , 歌手号 )
第2题:
You need to create a view EMP_VU. The view should allow the users to manipulate the records of only the employees that are working for departments 10 or 20. Which SQL statement would you use to create the view EMP_VU? ()
A. CREATE VIEW emp_vu AS SELECT * FROM employees WHERE department _ id IN (10,20);
B. CREATE VIEW emp_vu AS SELECT * FROM employees WHERE department_id IN (10,20) WITH READ ONLY;
C. CREATE VIEW emp_vu AS SELECT * FROM employees WHERE department_id IN (10,20) WITH CHECK OPTION;
D. CREATE FORCE VIEW emp_vu AS SELECT * FROM employees WITH department_id IN (10,20);
E. CREATE FORCE VIEW emp_vu AS SELECT * FROM employees WHERE department_id IN (10,20) NO UPDATE;
第3题:
A.When view V1 is created
B.Each time the REFRESH VIEW v1 statement is executed
C.Each time an SQL statement is executed against view V1
D.Only the first time an SQL statement is executed against view V1
第4题:
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
第5题:
根据“歌手”表建立视图myview,视图中含有“歌手号”左边第一位是"1”的所有记录,正确的SQL语句是( )。
A)CREATE VIEW myview AS SELECT * FROM 歌手 WHERE LEFT(歌手号,1)="1"
B)CREATE VIEW myview AS SELECT * FROM 歌手 WHERE LIKE("1",歌手号)
C)CREATE VIEW myview SELECT * FROM 歌手 WHERE LEFT(歌手号,1)="1"
D)CREATE VIEW myview SELECT * FROM 歌手 WHERE LIKE("1",歌手号)
第6题:
A view is created with the following statement:CREATE VIEW v1 AS SELECT col1, col2, col3, col4 FROM t1 WHERE col4 > 1000 WITH CHECK OPTIONWhat is the effect of the CHECK OPTION clause?()
第7题:
有关系模式:学生表(学号,姓名,所在系),建立统计每个系的学生人数的视图的正确语句是()
第8题:
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;()
第9题:
You need to create a view EMP_VU. The view should allow the users to manipulate the records of only the employees that are working for departments 10 or 20.Which SQL statement would you use to create the view EMP_VU?()
第10题:
You need to create a view EMP_VU. The view should allow the users to manipulate the records of only the employees that are working for departments 10 or 20. Which SQL statement would you use to create the view EMP_VU? ()
第11题:
Any row inserted or updated through view V1 must meet the condition that col4 > 1000.
From now on, any row inserted or updated in table T1 must meet the condition that col4 > 1000, but existing rows in the table are not checked.
At view creation, DB2 will check the data in table T1, and if in any row doesn't meet the condition col4 > 1000, the view creation will be rejected.
Any row inserted or updated through view V1 must meet the condition that col4 > 1000 and no row in table T1 can be updated such that col4 <= 1000, but new rows in the table can be inserted with col4 <= 1000.
第12题:
CREATE VIEW emp_vu AS SELECT * FROM employees WHERE department_id IN (10,20);
CREATE VIEW emp_vu AS SELECT * FROM employees WHERE department_id IN (10,20) WITH READ ONLY;
CREATE VIEW emp_vu AS SELECT * FROM employees WHERE department_id IN (10,20) WITH CHECK OPTION;
CREATE FORCE VIEW emp_vu AS SELECT * FROM employees WHERE department_id IN (10,20);
CREATE FORCE VIEW emp_vu AS SELECT * FROM employees WHERE department_id IN (10,20) NO UPDATE;
第13题:
根据SQL标准,创建一个视图abc,通过该视图只能对表student中系dept为‘IS’的记录进行更新操作。下面哪条语句适用?()
A create view abc as select * from student where dept=’IS’
B create view abc as select * from student where dept=’IS’ with check option
C create view abc as student where dept=’IS’
D create view abc as select dept=’IS’ from student
第14题:
查询所有目前年龄是22岁的学生信息:学号,姓名和年龄,正确的命令组是( )。
A.CREATE VIEW AGE LIST AS; SELECT 学号,姓名,YEAR(DATE())-YEAR(出生日期)年龄FROM学生; SELECT 学号,姓名,年龄FROM AGE LIST WHERE年龄=22
B.CREATE VIEW AGE LIST AS; SELECT 学号,姓名,YEAR(出生日期) FROM 学生; SELECT 学号,姓名,年龄FROM AGE LIST WHERE YEAR(出生日期)=22
C.CREATE VIEW AGE LIST AS; SELECT 学号,姓名,YEAR(DATE())-YEAR(出生日期)年龄FROM学生; SELECT 学号,姓名,年龄FROM学生WHEREYEAR(出生日期)=22
D.CREATE VIEW AGE LIST AS STUDENT; SELECT学号,姓名,YEAR(DATE())-YEAR(出生日期)年龄FROM学生; SELECT学号,姓名,年龄FROM STUDENT WHERE年龄=22
第15题:
Given the following DDL and INSERT statements:CREATE VIEW v1 AS SELECT col1 FROM t1 WHERE col1 > 10; CREATE VIEW v2 AS SELECT col1 FROM v1 WITH CASCADED CHECK OPTION; CREATE VIEW v3 AS SELECT col1 FROM v2 WHERE col1 < 100; INSERT INTO v1 VALUES(5); INSERT INTO v2 VALUES(5); INSERT INTO v3 VALUES(20); INSERT INTO v3 VALUES(100);How many of these INSERT statements will be successful?()
A.0
B.1
C.2
D.3
第16题:
The following statements:CREATE TABLE t1 (col1 INT NOT NULL, PRIMARY KEY(col1)); CREATE TABLE t2 (col1 INT NOT NULL, col2 CHAR(1) NOT NULL, PRIMARY KEY (col1, col2), FOREIGN KEY (col1) REFERENCES t1 (col1) ON DELETE CASCADE ON UPDATE RESTRICT); CREATE TABLE t3 (col1 INT NOT NULL, col2 INT NOT NULL, PRIMARY KEY (col1, col2),FOREIGN KEY (col1) REFERENCES t1 (col1) ON DELETE NO ACTION ON UPDATE RESTRICT);INSERT INTO t1 VALUES (1), (2); INSERT INTO t2 VALUES (1, ‘a‘), (1, ‘b‘), (2,‘c‘); INSERT INTO t3 VALUES (1, 100), (2, 200), (2,300);How many rows will be deleted by the following DELETE statement? DELETE FROM t1 WHERE col1= 1;()
A.4
B.3
C.1
D.0
第17题:
客服业务受到SQL语句的影响非常大,以下哪些是执行效率比较低的SQL语句,可以进行优化()
第18题:
设有关系模式商品(商品号,商品名称,单价,数量,类别),建立统计每类商品总数量的视图的正确语句是()
第19题:
存在两个结构相同的数据库表T1(col1,col2,col3)、T2(col1,col2,col3),写出一SQL语句将所有T1数据导入到T2表()
第20题:
The following statements: CREATE TABLE t1 (col1 INT NOT NULL, PRIMARY KEY(col1)); CREATE TABLE t2 (col1 INT NOT NULL, col2 CHAR(1) NOT NULL, PRIMARY KEY (col1, col2), FOREIGN KEY (col1) REFERENCES t1 (col1) ON DELETE CASCADE ON UPDATE RESTRICT); CREATE TABLE t3 (col1 INT NOT NULL, col2 INT NOT NULL, PRIMARY KEY (col1, col2),FOREIGN KEY (col1) REFERENCES t1 (col1) ON DELETE NO ACTION ON UPDATE RESTRICT);INSERT INTO t1 VALUES (1), (2); INSERT INTO t2 VALUES (1, 'a'), (1, 'b'), (2,'c'); INSERT INTO t3 VALUES (1, 100), (2, 200), (2,300); How many rows will be deleted by the following DELETE statement? DELETE FROM t1 WHERE col1= 1;()
第21题:
Examine the structure if the EMPLOYEES table: Column name Data Type Remarks EMPLOYEE_ID NUMBER NOT NULL, Primary Key EMP_NAME VARCHAR2(30) JOB_ID VARCHAR2(20) NOT NULL SAL NUMBER MGR_ID NUMBER References EMPLOYEE_ID column DEPARTMENT_ID NUMBER Foreign key to DEPARTMENT_ID column of the DEPARTMENTS table You need to create a view called EMP_VU that allows the user to insert rows through the view. Which SQL statement, when used to create the EMP_VU view, allows the user to insert rows? ()
第22题:
select col1,col2,col3 from T1 into T2(col1,col2,col3)
insert T1 (col1,col,col3) into T2(col1,col2,col3)
insert into T2 (col1,col2,col3) as select col1,col2,col3 from T1
insert into T2(col1,col2,col3) select col1,col2,col3 from T1;
第23题:
CREATE VIEW emp_vu AS SELECT * FROM employees WHERE department _ id IN (10,20);
CREATE VIEW emp_vu AS SELECT * FROM employees WHERE department_id IN (10,20) WITH READ ONLY;
CREATE VIEW emp_vu AS SELECT * FROM employees WHERE department_id IN (10,20) WITH CHECK OPTION;
CREATE FORCE VIEW emp_vu AS SELECT * FROM employees WITH department_id IN (10,20);
CREATE FORCE VIEW emp_vu AS SELECT * FROM employees WHERE department_id IN (10,20) NO UPDATE;