OCP-1Z0-051-Question Analysis-10th question

Source: Internet
Author: User

10. View the Exhibit and examine the structure of the PROMOTIONS table.

Each promotion has a duration of at least seven days.
Your manager has asked you to generate a report, which provides the weekly cost for each promotion
Done to l date.
Which query wocould achieve the required result?
A. SELECT promo_name, promo_cost/promo_end_date-promo_begin_date/7
FROM promotions;
B. SELECT promo_name, (promo_cost/promo_end_date-promo_begin_date)/7
FROM promotions;
C. SELECT promo_name, promo_cost/(promo_end_date-promo_begin_date/7)
FROM promotions;
D. SELECT promo_name, promo_cost/(promo_end_date-promo_begin_date)/7)
FROM promotions;


Answer: D

Question Analysis:

It means the average consumption per week during the promotion period.

According to the table given: the total cost of promotion is promo_cost length of promotion (promo_end_date-promo_begin_date), the length of promotion to the week need to divide 7

(Promo_end_date-promo_begin_date)/7, so the average weekly spending is promo_cost/(promo_end_date-promo_begin_date)/7)

Obviously, expression D is correct. This mainly deals with the order of expression operations. The answer ABC will prompt a syntax error during execution.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.