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而不能使用=,<>符号进行比较.  

  • 相关阅读:
    【大胃王】2013暴食女王巅峰战(安吉拉x三宅x正司x木下)熟肉+高能
    破解 CrackMe#1 [UBC] by bRaINbuSY
    栈实现符号平衡检测
    简单的栈
    数独算法
    win32绘图基础
    Win32基础知识整理
    Win32最简单的程序
    初学layer
    android 虚线
  • 原文地址:https://www.cnblogs.com/arcer/p/3157062.html
Copyright © 2011-2022 走看看