zoukankan      html  css  js  c++  java
  • OCP之黄伟 2

    Restricting and Sorting Data 

    Objectives

    After completing this lesson,you should be able to do the following:

    • Limit the rows that are retrieved by a query
    • Sort the rows that are retrieved by a query

    Character Strings and Dates

    列别名应当使用双引号

    字符串拼接或者日期信息,以及where子句中的数据,需要使用单引号

    • Character strings and date values are enclosed by single quotation marks
    • Character values are case-sensitive,and date values are format-sensitive.
    • The default date format is DD-MON-RR.
    SQL> SELECT last_name,job_id,department_id
      2  FROM employees
      3  WHERE last_name = 'Grant';
    
    LAST_NAME                 JOB_ID     DEPARTMENT_ID
    ------------------------- ---------- -------------
    Grant                     SH_CLERK              50
    Grant                     SA_REP
    
    SQL> SELECT last_name,job_id,department_id
      2  FROM employees
      3  WHERE last_name = 'grant';
    
    no rows selected
    View Code

    Using the LIKE Condition

    • Use the LIKE condition to perform wildcard searches of valid search string values.
    • Search conditions can contain either literal character or numbers:
      • % denotes zero or many characrters.
      • _ denotes one character
    • You can combine pattern-matching characters
    SELECT last_name FROM employees WHERE last_name LIKE '_o%';
    •  You can use the ESCAPE identifier to search for the actual % and _ symbols. 
    SELECT employee_id,last_name,job_id
    FROM employees
    WHERE job_id LIKE '%SA\_%' ESCAPE '';

    Using the NULL Conditions

    null value的比较只能使用IS NULL或者IS NOT NULL而不能使用=,<>符号进行比较.  

  • 相关阅读:
    wxpython仿写记事本
    HIVE提交command过程图
    SQL编辑器自动提醒实现
    hive.sh的内容分析
    Hive配置项的含义详解(5)
    比特币、莱特币来一发?
    引导孩子从“打针有点疼”开始
    For Wife
    我是真的爱你
    .net core 添加本地dll
  • 原文地址:https://www.cnblogs.com/arcer/p/3157062.html
Copyright © 2011-2022 走看看