下面的题tk可能答案错了
SQL> insert into (select * from y) values (1);
已创建 1 行。
SQL> insert into y values(select * from y);
insert into y values(select * from y)
*
ERROR 位于第 1 行:
ORA-00936: 缺少表达式
144 题答案错误
QUESTION 144:
In which four clauses can a subquery be used? (Choose four.)
A.in the INTO clause of an INSERT statement
B.in the FROM clause of a SELECT statement
C.in the GROUP BY clause of a SELECT statement
D.in the WHERE clause of a SELECT statement
E.in the SET clause of an UPDATE statement
F.in the VALUES clause of an INSERT statement
Answer: B, D, E, F Explanation : subquery can be use in the FROM clause of a SELECT statement, in the WHERE clause of a SELECT statement, in the SET clauses of an UPDATE statement, in the VALUES clause of an INSERT statement.Incorrect answer : A subquery cannot be used C subquery cannot be used Refer : Introduction to Oracle9i : SQL, Oracle University Study Guide, 6-5
在18-10
你可以在一个 SELECT 语句的 FROM 子句中使用子查询,这非常类似于视图的使
内联 (inline) 视图。一个在
用。一个在 SELECT 语句的 FROM 子句的子查询也被称为
SELECT 语句的 FROM 子句的子查询为特殊的 SELECT 语句定义一个数据源,并且仅
是 SELECT 语句。幻灯片中的例子显示所有那些薪水高于他所在的部门平均薪水的雇
员的名字、薪水、部门号和部门平均薪水。FROM 子句中的子查询命名为别名 b,并且
外查询引用该表别名的 SALAVG 列。
刚好下面这题也说明了a is right
QUESTION 164
--------------------------------------------------------------------------------
Examine the structure of the EMPLOYEES table:
EMPLOYEES table:
EMPLOYEE_ID NUMBER NOT NULL
EMP_NAME VARCHAR2(30)
JOB_ID VARCHAR2(20)
SAL NUMBER
MGR_ID NUMBER
DEPARTMENT_ID NUMBER
You want to create a SQL script file that contains an INSERT statement. When the script is run, the INSERT statement should insert a row with the specified values into the EMPLOYEES table. The INSERT statement should pass values to the table columns as specified below:
EMPLOYEE_ID: Next value from the sequence EMP_ID_SEQEMP_NAME
JOB_ID: As specified by the user during run time, through substitution variables
SAL: 2000
MGR_ID: No value
DEPARTMENT_ID: Supplied by the user during run time through substitution variable.
The INSERT statement should fail if the user supplies a value other than 20 or 50.
Which INSERT statement meets the above requirements?
A.
INSERT INTO employees
VALUES (emp_id_seq.NEXTVAL, '&ename', '&jobid', 2000, NULL, &did);
B.
INSERT INTO employees
VALUES (emp_id_seq.NEXTVAL, '&ename', '&jobid', 2000, NULL, &did IN (20,50));
C.
INSERT INTO (SELECT * FROM employees
WHERE department_id IN (20,50))
VALUES (emp_id_seq.NEXTVAL, '&ename', '&jobid', 2000, NULL, &did);
D.
INSERT INTO (SELECT * FROM employees
WHERE department_id IN (20,50)
WITH CHECK OPTION)
VALUES (emp_id_seq.NEXTVAL, '&ename', '&jobid', 2000, NULL, &did);
E.
INSERT INTO (SELECT * FROM employees
WHERE (department_id = 20 AND
department_id = 50) WITH CHECK OPTION )
VALUES (emp_id_seq.NEXTVAL, '&ename', '&jobid', 2000, NULL, &did);
QUESTION 168:
第18章高级子查询包括了多列的IN比较不知道属不属于inequality comparison operator
Which two statements about subqueries are true? (Choose two.)
A.A subquery should retrieve only one row.
B.A subquery can retrieve zero or more rows.
C.A subquery can be used only in SQL query statements.
D.Subqueries CANNOT be nested by more than two levels.
E.A subquery CANNOT be used in an SQL query statement that uses group functions.
F.When a subquery is used with an inequality comparison operator in the outer SQL statement, the column list in the SELECT clause of the subquery should contain only one column.
Answer: B, F
Explanation : subquery can retrieve zero or more rows, subquery is used with an inequality camparison operator in the outer SQL statement, the column list in the SELECT clause of the subquery should contain only one column.Incorrect answer : A subquery can retrieve zero or more rows C subquery is not SQL query statement D subquery can be nested E group function can be use with subquery
C的SQL query statements是否指select语句
QUESTION 171:
Which two statements are true about constraints? (Choose two.)
A.The UNIQUE constraint does not permit a null value for the column.
B.A UNIQUE index gets created for columns with PRIMARY KEY and UNIQUE constraints.
C.The PRIMARY KEY and FOREIGN KEY constraints create a UNIQUE index.
D.The NOT NULL constraint ensures that null values are not permitted for the column.
Answer: A, D
Explanation : the UNIQUE constraint does not permit a null value for the column The NOT NULL constraint ensure that null value are not permitted for the column Incorrect answer : B statement is not true C statement is not true Refer : Introduction to Oracle9i : SQL, Oracle University Study Guide, 10-9
我认为是BD
UNIQUE 约束
UNIQUE 键完整性约束,要求列或者列的组合中 (键) 的每个值是唯一的,既,在
表中指定的列或列组合中不能有两行有相同的值。定义 UNIQUE 键约束的列 (或列组合)
被称为唯一键 (unique key)。
除非你对相同的列也定义了 NOT NULL 约束,UNIQUE 约束允许输入空值,事实
上,对于无 NOT NULL 约束的列,能包含空值的行可以是任意数目,因为空不等于任
何事。在一个列 (或者在一个复合 UNIQUE 键中的所有列) 中的空总是满足 UNIQUE
约束。
QUESTION 172:
D的解释都说明了可以update
Which three are true? (Choose three.)
A.A MERGE statement is used to merge the data of one table with data from another.
B.A MERGE statement replaces the data of one table with that of another.
C.A MERGE statement can be used to insert new rows into a table.
D.A MERGE statement can be used to update existing rows in a table.
Answer: A, B, C
Explanation : Merge is used to merge the data of one table with data from another, replaces the data of one table with that of another, used to insert new rows into a table.Incorrect answer : D MERGE statement can be used to update existing rows in a table if the condition match
|