11. View the Exhibit and examine the structure of the PRODUCTS table.
All products have a list price. 
You issue the following command to display the total price of each product after a discount of 25% and a
tax of 15% are  applied on it. Freight charges of $100 have to be applied to all the products.
SQL>SELECT prod_name, prod_list_price -(prod_list_price*(25/100))                 
+(prod_list_price -(prod_list_price*(25/100))*(15/100))+100                                 
AS "TOTAL PRICE" 
FROM products; 
What would be the outcome if all the parentheses are removed from the above statement?
 
A. It produces a syntax error.
B. The result remains unchanged. 
C. The total price value would be lower than the correct value. 
D. The total price value would be higher than the correct value.
 
Answer: B
题目解析:
题目的意思是:表中产品的价格降价25%后,加上税金15%,再加上运费100后产品的新价格。题目给出了产品新价格的sql语句,
问,如果把该sql语句的括号都去了,结果会怎样?
这题也是考表达式的运算顺序
原sql执行结果
SELECT prod_name, prod_list_price -(prod_list_price*(25/100))
+(prod_list_price -(prod_list_price*(25/100))*(15/100))+100
 AS "TOTAL PRICE"
 FROM products where rownum<10; PROD_NAME TOTAL PRICE
--------------------------------- -----------
VRAM - 64 MB 577.7875
CPU D300 272.9625
CPU D400 310.6375
CPU D600 404.825
GP 1024x768 233.575
GP 1280x1024 267.825
GP 800x600 182.2
MB - S300 194.1875
MB - S450 213.025

去括号后sql执行结果

SELECT prod_name, prod_list_price -prod_list_price*25/100
+prod_list_price -prod_list_price*25/100*15/100+100
 AS "TOTAL PRICE"
 FROM products where rownum<10; PROD_NAME TOTAL PRICE
--------------------------------- -----------
VRAM - 64 MB 577.7875
CPU D300 272.9625
CPU D400 310.6375
CPU D600 404.825
GP 1024x768 233.575
GP 1280x1024 267.825
GP 800x600 182.2
MB - S300 194.1875
MB - S450 213.025

结果是一样的,所以选B

其实这道题,题目给的sql的括号位置应该错了,正确的应该是 这样的

 SELECT prod_name, prod_list_price -(prod_list_price*(25/100)) 
+(prod_list_price -(prod_list_price*(25/100)))*(15/100)+100 
AS "TOTAL PRICE" 
FROM products;

如果是题目给的括号位置,可以测试下

select 100 -(100*(25/100))+(100 -(100*(25/100))*(15/100))+100  from dual;

100-(100*(25/100))+(100-(100*(25/100))*(15/100))+100
----------------------------------------------------
271.25

结果是271.25了,显示和题目说的不一致。

 

OCP-1Z0-051-题目解析-第11题的更多相关文章

  1. 1Z0-053 争议题目解析

    1Z0-053 争议题目解析 Summary 题目NO. 题目解析链接地址 题库答案 参考答案 考查知识点  24 http://www.cnblogs.com/jyzhao/p/5319220.ht ...

  2. 1Z0-053 争议题目解析304

    1Z0-053 争议题目解析304 考试科目:1Z0-053 题库版本:V13.02 题库中原题为: 304.What privileges must be granted to allow an a ...

  3. 1Z0-053 争议题目解析330

    1Z0-053 争议题目解析330 考试科目:1Z0-053 题库版本:V13.02 题库中原题为: 330.What will be the end result of this set of RM ...

  4. 1Z0-053 争议题目解析541

    1Z0-053 争议题目解析541 考试科目:1Z0-053 题库版本:V13.02 题库中原题为: 541.If you use ALTER DISKGROUP ... ADD DISK and s ...

  5. 1Z0-053 争议题目解析686

    1Z0-053 争议题目解析686 考试科目:1Z0-053 题库版本:V13.02 题库中原题为: 686.You execute the following FLASHBACK TABLE com ...

  6. 1Z0-053 争议题目解析688

    1Z0-053 争议题目解析688 考试科目:1Z0-053 题库版本:V13.02 题库中原题为: 688.Which two statements are true about the compr ...

  7. 1Z0-053 争议题目解析25

    1Z0-053 争议题目解析25 考试科目:1Z0-053 题库版本:V13.02 题库中原题为: 25.You enabled Flashback Data Archive on the INVEN ...

  8. 1Z0-053 争议题目解析24

    1Z0-053 争议题目解析24 考试科目:1Z0-053 题库版本:V13.02 题库中原题为: 24.Which of the following information will be gath ...

  9. 1Z0-053 争议题目解析46

    1Z0-053 争议题目解析46 考试科目:1Z0-053 题库版本:V13.02 题库中原题为: 46.What happens when you run the SQL Tuning Adviso ...

随机推荐

  1. Android checkbox和radiobutton 以及Toast和AlertDialog的使用

    package com.example.radiobutton_01; import android.app.Activity; import android.os.Bundle; import an ...

  2. C++ Primer 学习笔记_41_STL实践与分析(15)--先来看看算法【下一个】

    STL实践与分析 --初窥算法[下] 一.写容器元素的算法 一些算法写入元素值.在使用这些算法写元素时一定要当心.必须.写入输入序列的元素 写入到输入序列的算法本质上是安全的--仅仅会写入与指定输入范 ...

  3. 【jQuery】使用JQ要准备的主要淡入淡出效果

    jQuery是JavaScript 库.也就是JavaScript延期,加入满足不同效果的不断增长的需求.事实上质量JavaScript 下面写的一大JQ方案说明JQ. .基本目标 网页中有例如以下三 ...

  4. NSIS:获取硬盘中容量最大的分区盘符

    原文 NSIS:获取硬盘中容量最大的分区盘符 我们在安装一些在线视频软件比如迅雷看看时,会发现他们的安装程序会自动判断当前系统中容量最大的分区,以便在其中创建数据缓冲下载的文件夹,这种功能如果实现呢, ...

  5. poj 3975&amp;&amp;hdu 1850 (nim)

    //赢得了上风 //从n几年移除堆叠一堆石头,有多少可取的石头堆 # include <stdio.h> # include <string.h> # include < ...

  6. Explicit keyword

    说实话,从来没有感觉到这个keyword实用,直到今天. explicit的意思是明显的,和它相相应的一个词是implicit意思是隐藏的. 我參考了MSDN和<c++标准程序库>对这个k ...

  7. j2se--Socket沟通

    第一次接触Socket课程设计大二,我在做一个图书馆管理系统.源代码是从互联网上下载,代码天天磨,隐约中记得有Socket这么一个单词. 第二次是去年代表学校參加"河北省电子信息职业技能大赛 ...

  8. 開始开发 Dashboard Widgets,第2章,读书笔记

    文件夹:http://blog.csdn.net/wide288/article/details/40298693 主要内容: widgets 的组成是什么. 怎么创建 info.plist 文件 怎 ...

  9. Object-c中间initialize 与 辛格尔顿

    简单说下initialize任务.在初始化过程中同样的类将被调用一次. 直接在代码解释initialize任务. 创建一个InitTest类 InitTest.m #import "Init ...

  10. Android Push Notifications using Google Cloud Messaging (GCM), PHP and MySQL

    http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php- ...