Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1065886
  • 博文数量: 239
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 3618
  • 用 户 组: 普通用户
  • 注册时间: 2012-11-12 13:17
文章分类

全部博文(239)

文章存档

2021年(1)

2016年(1)

2015年(30)

2014年(91)

2013年(116)

分类: Oracle

2015-03-20 01:57:06

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

另外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;

阅读(1140) | 评论(0) | 转发(0) |
0

上一篇:1Z0-051-12题

下一篇:Linux开机自启动weblogic

给主人留下些什么吧!~~