zoukankan      html  css  js  c++  java
  • oracleI基础入门(6)sql语句Substring Crazy

    SQL 中的 substring 函数是用来抓出一个栏位资料中的其中一部分。这个函数的名称在不同
    的数据库中不完全一样:
    MySQL: SUBSTR(), SUBSTRING()
    Oracle: SUBSTR()
    最常用到的方式如下 (在这里我们用SUBSTR()为例):
    SUBSTR(str,pos): 由<str>中,选出所有从第<pos>位置开始的字符。请注意,这个语法不适
    用于SQL Server 上。
    SUBSTR(str,pos,len): 由<str>中的第<pos>位置开始,选出接下去的<len>个字符。
    假设我们有以下的表格:
    Geography 表格
    region_name           store_name
    East                        Boston
    East                        New York
    West                      Los Angeles
    West                      San Diego
    例1:
    SELECT SUBSTR(store_name, 3) FROM Geography WHERE store_name = 'Los Angeles';
    结果:
    's Angeles'
    例2:
    SELECT SUBSTR(store_name,2,4) FROM Geography WHERE store_name = 'San Diego';
    结果:
    'an D'

    绝圣弃智,民利百信;绝仁弃义,民复孝慈;绝巧弃利,盗贼无有
  • 相关阅读:

    logging 模块和日志
    re 模块和正则表达式
    collections 模块
    hashlib 模块
    序列化 json 和 pickle
    C++之以分隔符的形式获取字符串
    读取配置文件所在路径时的一种常见错误
    char和achar互转
    C++之ARX,Acstring,ACahr转char
  • 原文地址:https://www.cnblogs.com/flyscan/p/2534897.html
Copyright © 2011-2022 走看看