zoukankan      html  css  js  c++  java
  • 【每日一题之OCP-043】question 2

    question 2

    view the Exhibit and examine the description of the CUSTOMERS table.You want to add a constraint on the CUST_FIRST_NAME column of the CUSTOMERS table so that the value inserted in the column does not have numbers. Which SQL statement would you use to accomplish the task?

    • A.ALTER TABLE CUSTOMERS ADD CONSTRAINT cust_f_name CHECK(REGEXP_LIKE(cust_first_name,'^A-Z')) NOVALIDATE;
    • B.ALTER TABLE CUSTOMERS ADD CONSTRAINT cust_f_name CHECK(REGEXP_LIKE(cust_first_name,'[1]')) NOVALIDATE;
    • C.ALTER TABLE CUSTOMERS ADD CONSTRAINT cust_f_name CHECK(REGEXP_LIKE(cust_first_name,'[[:alpha:]]')) NOVALIDATE;
    • D.ALTER TABLE CUSTOMERS ADD CONSTRAINT cust_f_name CHECK(REGEXP_LIKE(cust_first_name,'[[:digit:]]')) NOVALIDATE;

    Correct Answer C

    查看图例中对表CUSTOMERS 的定义和描述。你想给表CUSTOMERS的CUST_FIRST_NAME字段添加约束,以实现插入到表的数据中该字段不含有数字。以下哪个sql语句可以实现上述功能?

    正确答案:C

    解析:

    本题考察的是REGEXP_LIKE以及正则表达式的用法。以下是oracle官方文档中对REGEXP_LIKE的说明。

    • REGEXP_LIKE is similar to the LIKE condition, except REGEXP_LIKE performs regular expression matching instead of the simple pattern matching performed by LIKE. This condition evaluates strings using characters as defined by the input character set.

    • This condition complies with the POSIX regular expression standard and the Unicode Regular Expression Guidelines.

    • REGEXP_LIKE使用正则表达式进行匹配,而不是执行简单的模式匹配,除此之外,它的用法和LIKE类似。这个条件使用输入字符串的定义字符集作为评估使用的字符集。

    • 这个条件符合POSIX正则表达式标准和Unicode正则表达式的指导方针。

    • 此题使用字符簇进行匹配,常用字符簇标准如下表:

    • 答案A:以大写字幕开头,B:不以数字开头,C:只包含字母,D:只包含数字。故答案C正确。

    1. 0-9 ↩︎

  • 相关阅读:
    Kafka 设计思路
    DBeaver——超好用可视化数据库!(墙裂推荐(づ ̄3 ̄)づ╭❤~)
    蓝图BluePrint——基于Flask框架
    SkyWalking全链路监控java项目
    win10创建ssh公钥
    mysql通过列名搜索出表名
    使用nodejs判断前端性能
    golang 栈、堆分配分析及CPU、内存性能情况
    UML图-(用例图、类图、状态图、活动图、时序图)
    linux参数调优
  • 原文地址:https://www.cnblogs.com/upcyaya/p/6594020.html
Copyright © 2011-2022 走看看