第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;


考查字符串的连接。 字符串中包含但引号应该如何处理

prod_name || 's category is || prod_category

有两种实现方法。 

1。 用两个单引号代替一个单引号

       SELECT prod_name || '''scategory is ' || prod_category CATEGORIES from products;

2.使用q 操作符号

    select q'[It's Oracle's world ]' from dual

      语法q 'xbbbbbbx'
      q后面跟着两个单引号封闭内容。用两个字符将不需要转换的内容包起来

选项 A category is ' 缺少单引号

A. SELECT prod_name || q'''s category is '' || prod_category CATEGORIES
 FROM products;

选项 B category 前面缺少单引号

        B. SELECT prod_name || q'['s ]' || ‘category is ' || prod_category CATEGORIES

       FROM products;


正确答案是CD

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值