Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

OCP-1Z0-05162 personal understanding

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

I. Original title

View the Exhibit and examine the structure of the CUSTOMERS table.

You want to generate a report showing the last names and credit limits of all customers whose last names start with A, B, or C, and credit limit is below 10, 000.

Evaluate the following two queries:

SQL> SELECT cust_last_name, cust_credit_limit

FROM customers

WHERE (UPPER(cust_last_name) LIKE 'A%' OR UPPER(cust_last_name) LIKE 'B%' OR UPPER(cust_last_name) LIKE 'C%')

AND cust_credit_limit

< 10000; SQL>

SELECT cust_last_name, cust_credit_limit FROM customers

WHERE UPPER(cust_last_name) BETWEEN 'A' AND 'C'

AND cust_credit_limit < 10000;

Which statement is true regarding the execution of the above queries?

A. Only the first query gives the correct result.

B. Only the second query gives the correct result

C. Both execute successfully and give the same result.

D. Both execute successfully but do not give the required result.

Answer: A

Personal understanding:

The first condition of the question requires returning customer names beginning with letters A,B, and C. Query 2 does not return results that meet the requirements. There are many explanations for the reasons. According to personal understanding, the second query returns a query that starts with A and B (including case!). All and single letter C (including upper and lower case C) user names.

In fact, I think this question has some problems. Since it is only to judge the initial letter, then the UPPER function is not used by convention, because the initial letter is already capitalized by convention.(Isn't it better to understand INITCAP here?) Does using the UPPER function mean returning names that begin with lowercase letters a, b, and c? (There is no explanation in the table that this field must start with capital letters. The convention cannot be directly defaulted.) However, it seems that the title stem only requires capital letters to start with. How can UPPER query judgment only return capital letters to start with? Unless there is another explanation, ABC letters without double quotes indicate both upper and lower case letters, while double quotes indicate only upper case letters.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report