071-新增2

  1. View the Exhibit and examine the description of the EMPLOYEES table Evaluate the following SQL statement: SELECT first_ name, employee_ id, NEXT_ DAY (ADD MONTHS (hire. date, 6), 1) "Review FROM employees;
    The query was written to retrieve the FIRST_ NAME, EMPLOYEE ID, and review date for employees.
    The review date is the first Monday after the completion of six months of the hiring. The NLS_ TERRITORY parameter is set to AMERICA in the session.
    Which statement is true regarding this query?
    A) The query would execute to give the desired output.
    B) The query would not execute because date functions cannot be nested.
    C) The query would execute but the output would give review dates that are Sundays.
    D) The query would not execute because the NEXT_DAY function accepts a string as argument.

日期是从周天到周六数的,所以输出的应该是周天

  1. Examine these SQL commands:
    SQL> CREATE TABLE products( prod_id NUMBER(3) CONSTRAINT p_ck CHECK (prod_id> 0), Prod_name CHAR(30) , prod_ qty NUMBER(6), CONSTRAINT P_name NOT NULL (prod_name), CONSTRAINT prod_ pk PRIMARY KEY (prod_id));
    SQL> CREAIEC TARTE warehouse( warehouse_ id NUMBER(4), Room_no NUMBER(10) CONSTRAINT r_id CHECK (room_no BETWEEN 101 AND 200), location VARCHAR2 (25), prod_ id NUMBER(3) , CONSTRAIN wr_pr_pk PRIMARY key (warehouse_ id,prod_id), COUSIRAINT prod_ fk FOREIGN REY (prod . _ id) REFERENCES products(prod_id));
    Which statement is true?
    A) Both commands execute successfully
    B) The first CREATE TABLE command generates an error because the NULL constraint is not valid.
    C) The second CREATE TABLE command generates an error because the CHECK constraint is not valid.
    D) The first CREATE TARIE command generates an error because CHECK and PRIMARY KEY constraints cannot be used for the same column.
    E) The first CREATE TABLE command generates an error because the column PROD_ ID cannot be used in the PRIMARY KEY and FOREIGH KEY constraints.
    not null 只能定义在列级别

  2. 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 customoes 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.

Between and 在字符间的区间为前闭后开,所以第二个输出就没有 C 打头的顾客信息。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值