OCP

【2019年8月版】OCP 071认证考试原题-第38题

≯℡__Kan透↙ 提交于 2019-12-05 19:06:37
choose two. You need to calculate the number of days from 1st January 2019 until today. Dates are stored in the default format of DD-MON-RR. Which two queries give the required output? A) SELECT SYSDATE - TO_DATE (' 01-JANUARY-2019' ) FROM DUAL; B) SELECT TO_DATE (SYSDATE, ' DD/MONTH/YYYY' ) - '01/JANUARY/2019' FROM DUAL; C) SELECT ROUND (SYSDATE - TO_DATE(' 01/JANUARY/2019' ) ) FROM DUAL; D) SELECT TO_CHAR (SYSDATE, ' DD-MON-YYYY') - '01-JAN-2019' FROM DUAL; E) SELECT ROUND (SYSDATE- '01-JAN-2019') FROM DUAL: Answer:AC (解析:在进行日期计算的时候需要用转换函数把字符型的转换成日期型,oracle 不会隐式转换。) 来源: https://my.oschina

【2019年8月版】OCP 071认证考试原题-第37题

大兔子大兔子 提交于 2019-12-05 19:04:35
Choose the best answer Examine the description of the PRODUCT_INFORMATION table: Name NULL? Type ------------------------------------------------------------------------ PROD_ID NOT NULL NUMBER(2) PROD_NANE VARCRAR2 (10) LIST_PRICE NUMBER(6,2) Which query retrieves the number of products with a null list price? A) SELECT (COUNT(list_price) FERM Product_intormation WHERE list_price=NULL; B) SELECT Count(nvl( list_price,0) )FROM pruduct_information WHERE list_price is null; C) SELECT COUNT(DISTINCT list_price) FROM produet_infomation WHERE list_price is nulll. D) SELECT COUNT(list_price) from

【2019年8月版】OCP 071认证考试原题-第36题

南楼画角 提交于 2019-12-05 13:49:12
Choose three Which three statements are true about sequences in a single instance Orade database? A) A sequence's unallocated cached values are lost if the instance shuts down. B) Two or more tables cannot have keys generated from the same sequence. C) A sequence number that was allocated can be rolled back if a transaction fails. D) A sequence can issue duplicate values. E) Sequences can always have gaps. F) A sequence can only be dropped by a DBA. Answer::ADE (解析:虚拟可以一下子产生一组的数字缓存在内存中,但是实例关闭,没有用到的数字也将丢失;序列可以产生重复的值在定义的时候用 cycle 关键字,步长如果不是定义为 1,则产生的数字就不是连续的。) 来源: https://my.oschina.net/u

【2019年8月版】OCP 071认证考试原题-第35题

一世执手 提交于 2019-12-05 13:41:58
choose two Which two statenents are tue about the COUNT function? A) It can only be used for NUMBER data types. B) COUNT (DISTINCT inv_amt) returns the number of rows excluding rows containing dupicates and NULLs in the INV_AMT column C) COUNT(*) returns the number of rows in a table including duplicate rows and rows containing NULLs in any column. D) A SELECT statement using the COUNT function with a DISTINCT keyword cannot have a WHERE clause. E) COUNT(inv_amt) returns the number of rows in a table including rows with NULL in the INV_AMT column. Answer::BC (解析:count 对于 null 值是忽略的;可以与 where

【2019年8月版】OCP 071认证考试原题-第34题

為{幸葍}努か 提交于 2019-12-05 01:50:51
Choose two. Which two statements are true about the results of using the INTERSECT operator in compound queres? A) Reversing the order of the intersected tables can sometimes affect the output. B) Column names in each SELECT in the compound query can be dfferent. C) INTERSECT returns rows common to both sides of the compound query. D) The number of columns in each SELECT in the compound query can be dfferent. E) INTERSECT ignores NULLs Answer::BC (解析:intersect 会以第一个查询的第一个列的值进行排序输出,由于求的是交集,所以表的查询顺序可以不分先后;列的名字可以不一样,但是数据类型必须匹配。) 来源: https://my.oschina.net/u/3902946/blog/3131600

【2019年8月版】OCP 071认证考试原题-第34题

南笙酒味 提交于 2019-12-05 01:50:45
Choose two. Which two statements are true about the results of using the INTERSECT operator in compound queres? A) Reversing the order of the intersected tables can sometimes affect the output. B) Column names in each SELECT in the compound query can be dfferent. C) INTERSECT returns rows common to both sides of the compound query. D) The number of columns in each SELECT in the compound query can be dfferent. E) INTERSECT ignores NULLs Answer::BC (解析:intersect 会以第一个查询的第一个列的值进行排序输出,由于求的是交集,所以表的查询顺序可以不分先后;列的名字可以不一样,但是数据类型必须匹配。) 来源: https://www.cnblogs.com/cnblogs5359/p/11895815.html

【2019年8月版】OCP 071认证考试原题-第33题

纵然是瞬间 提交于 2019-12-05 01:48:30
Choose three. Which three statements are true about a self join? A) It must be an inner join. B) It can be an outer join. C) The ON clause must be used. D) It must be an equijoin. E) The query must use twodifferent aliases for the table. F) The ON clause can be used. Answer::BCD (解析:左连接其实就是左外连接,是不同的称呼而已,其结果都是一样的,ANSI 语法有 左连接的语法,而 oracle 语法中用(+)来表示。) select emp.empno,emp.deptno,dept.deptno,dept.dname from emp left join dept on emp.deptno=dept.deptno; select emp.empno,emp.deptno,dept.deptno,dept.dname from emp left outer join dept on emp.deptno=dept.deptno; select emp.empno,emp.deptno,dept

【2019年8月版】OCP 071认证考试原题-第33题

时光总嘲笑我的痴心妄想 提交于 2019-12-05 01:48:20
Choose three. Which three statements are true about a self join? A) It must be an inner join. B) It can be an outer join. C) The ON clause must be used. D) It must be an equijoin. E) The query must use twodifferent aliases for the table. F) The ON clause can be used. Answer::BCD (解析:左连接其实就是左外连接,是不同的称呼而已,其结果都是一样的,ANSI 语法有 左连接的语法,而 oracle 语法中用(+)来表示。) select emp.empno,emp.deptno,dept.deptno,dept.dname from emp left join dept on emp.deptno=dept.deptno; select emp.empno,emp.deptno,dept.deptno,dept.dname from emp left outer join dept on emp.deptno=dept.deptno; select emp.empno,emp.deptno,dept

【2019年8月】OCP 071认证考试最新版本的考试原题-第31题

▼魔方 西西 提交于 2019-12-04 23:06:28
Choose two Examine the data in the CUST NAME column of the CUSTOMERS table: CUST_NAME ------------------------------ Renske Ladwig Jason Mallin Samuel McCain Allan MCEwen Irene Mikkilineni Julia Nayer You want to display the CUST_NAME values where the last name starts with Mc or MC. Which two WHERE clauses give the required result? A) WHERE INITCAP (SUBSTR(cust_name, INSTR(cust_name,' ') +1 ) ) IN ('MC%', 'Mc%) B) WHERE UPPER (SUBSTR(cust_nane, INSTR(cust_name, ' ') +1 ) ) LIKE UPPER('MC%') C) WHERE INITCAP(SUBSTR(cust_nane, INSTR(cust_name,' ') +1 ) ) LIKE 'Mc%' D) WHERE SUBSTR(cust_name

【2019年8月】OCP 071认证考试最新版本的考试原题-第30题

限于喜欢 提交于 2019-12-04 20:39:18
choose two Evalute these conmands which execate sucestully CREATE SEQUENCE ord_seq INCREMENT BY 1 START WITH 1 MAXVALUE 100000 CYCLE CACHE 5000; Which two statements are true atout the ORD_ITEMS table and the ORD_SEQ sequence? A) Any user inserting rows into table ORD_ITEMS must have been granted access to sequence ORD_SEQ. B) Colunn ORD_NO gets the next number from squence ORD_SEQ whenever a row is inserted into ORD_ITEMS and no explict value is given for ORD_NO. C) Sepuence ORD_SEQ cycles back to 1 after every 5000 numbers and can cycle 20 times D) IF sequence ORD_SEQ is dropped then the