1. 程式人生 > >OCP-1Z0-051-題目解析-第13題

OCP-1Z0-051-題目解析-第13題

13. View the Exhibit and examine the structure of the PRODUCTS table.


You need to generate a report in the following format:
CATEGORIES
5MP Digital Photo Camera's category is Photo
Y Box's category is Electronics
Envoy Ambassador's category is Hardware
Which two queries would give the required output? (Choose two.)

A. SELECT prod_name q'''s category is ' prod_category CATEGORIES
FROM products;
B. SELECT prod_name q'['s ]'category is ' prod_category CATEGORIES
FROM products;
C. SELECT prod_name q'\'s\' ' category is ' prod_category CATEGORIES
FROM products;
D. SELECT prod_name q'<'s >' 'category is ' prod_category CATEGORIES


FROM products;

注意:選項中字串之間的連線應加連線符||
Answer: CD

題目解析:
sql中字串的兩邊是需要加單引號的,表示字串的開始和結束,如果我們想在sql中輸出一個實際的單引號',那麼需要連續輸入四個單引號'''',其中中間的兩個單引號表示一個單引號。
第一個單引號:表示字串開始
第二個單引號:表示轉義,後面接的單引號轉義為真正的單引號
第三個單引號:表示實際輸出的單引號
第四個單引號:表示字串結束
如:
SQL> select '''' name from dual;

N
-
'
SQL> select 'Camera''s category is Photo' name from dual;

NAME
--------------------------
Camera's category is Photo


另外Oracle還提供了一個Q-quote的表示式,來簡化SQL或PLSQL中字串的表示,其格式為q'[Camera's category is Photo]',輸出為方括號中的原始字串格式,其中方括號可以更換為其他的任意一對特殊符號,但必須是成對出現的,不可為q'[Camera's category is Photo|'。
如:
SQL> select q'[Camera's category is Photo]' name from dual;

NAME
--------------------------
Camera's category is Photo

SQL> select q'|Camera's category is 'Photo'|' name from dual;

NAME
----------------------------
Camera's category is 'Photo'

A:錯誤, is後面應該是兩個單引號,正確的為
SELECT prod_name || q'''s category is ''|| prod_category CATEGORIES
FROM products;
B:錯誤,category 前面少了一個',正確的為
SELECT prod_name || q'['s ]'||'category is '||prod_category CATEGORIES FROM products;

相關推薦

OCP-1Z0-051-題目解析-13

13. View the Exhibit and examine the structure of the PRODUCTS table. You need to generate a report in the following format:CATEGORIES5

OCP-1Z0-051-題目解析-16

blog ror cau 花括號 pan 使用 data eval from 16. Evaluate the following query: SQL> SELECT promo_name q‘{‘s start date was }‘ promo_begi

OCP-1Z0-051-題目解析-21

spa true div 一個 swe ron column examine ons 21. Examine the description of the EMP_DETAILS table given below: name NULL

OCP-1Z0-051-題目解析-9

lec 字段 ans cte ria reg tom for rgb 9. Which statement is true regarding the INTERSECT operator? A. It ignores NULL values. B.

OCP-1Z0-051-題目解析-22

22. You need to create a table for a banking application. One of the columns in the table has the following requirements:  1) You want a

OCP-1Z0-051-題目解析-35

35. Which two statements are true regarding constraints? (Choose two.)  A. A table can have only one primary key and one foreign key.  B.

OCP-1Z0-051-題目解析-19

19. Evaluate the following query: SELECT INTERVAL '300' MONTH, INTERVAL '54-2' YEAR TO MONTH, INTERVAL '11:12:10.1234567' HOUR TO SECON

OCP-1Z0-051-題目解析-6

6. Examine the structure of the SHIPMENTS table: name                    Null         Type PO_ID               NOT NULL    NUMBER(3)

OCP-1Z0-051-題目解析-12

12. You need to produce a report where each customer's credit limit has been incremented by $1000. Inthe output, the customer's last nam

OCP 1Z0 051 V9 02 13

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!        

OCP-1Z0-051 補充5 主查詢和子查詢的注意事項

Which three statements are true regarding sub queries? (Choose three.)A. Multiple columns or expressions can be compared between the main query and sub que

OCP-1Z0-051 174 事務的組成

Which statement is true regarding transactions? (Choose all that apply.) A. A transaction can consist only of a set of DML and DDL statements.B. A part or

OCP-1Z0-051 補充10 集合操作中的ORDER BY子句

Evaluate the following SQL statement: Which statement is true regarding the outcome of the above query?A. It produces an error because the ORDER BY clause

OCP-1Z0-051 補充26 單行函式特點

Which two statements are true regarding single row functions? (Choose two.) A. They can be nested only to two levelsB. They always return a single result r

OCP-1Z0-051 補充1 TRUNCATE命令的使用

Evaluate the SQL statement:TRUNCATE TABLE DEPT;Which three are true about the SQL statement? (Choose three.)A. It releases the storage space used by the ta

OCP-1Z0-051 51 SYNONYM同義詞

Which statement is true regarding synonyms? A. Synonyms can be created only for a table. B. Synonyms are used to reference only those tables that are owned

OCP-1Z0-051 補充43 子查詢

Evaluate the following query:      What would be the outcome of executing the above SQL statement? A. It produces an errorB. It shows the names of products

OCP-1Z0-051 54

View the Exhibit and examine the structure of the CUSTOMERS table. Evaluate the query statement: SQL> SELECT cust_last_name, cust_city, cust_credit_limi

OCP-1Z0-051 補充37

See the exhibit and examine the structure of the CUSTOMERS and GRADES tables: You need to display names and grades of customers who have the highest credit

ocp 1Z0-051 23-70解析

23. Examine thestructure proposed for the TRANSACTIONS table: name Null Type TRANS_ID NOT NULLNUMBER(6) CUST_NAME NOT NULLVAR