zoukankan      html  css  js  c++  java
  • sql

    mysql>-- 笛卡尔积查询,无连接条件查询
    mysql>select a.*,b.* from customers a , orders b ;

    mysql>-- 内连接,查询符合条件的记录.
    mysql>select a.*,b.* from customers a , orders b where a.id = b.cid ;

    mysql>-- 左外连接,查询符合条件的记录.
    mysql>select a.*,b.* from customers a left outer join orders b on a.id = b.cid ;

    mysql>-- 右外连接,查询符合条件的记录.
    mysql>select a.*,b.* from customers a right outer join orders b on a.id = b.cid ;

    mysql>-- 全外连接,查询符合条件的记录(mysql不支持全外链接)
    mysql>select a.*,b.* from customers a full outer join orders b on a.id = b.cid ;

    oracle中字符串的截取获取:

    获取类似“12R22.5国产无内胎”字符串中所有a-z和数字的值

    select a.vin , translate(a.tires_type,
    '#' || translate(a.tires_type,
    'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.',
    '#'),
    '/') tires_type
    from T_V_AXLE_INFO a

    字符串截取

    以使用instr函数对某个字符串进行判断,判断其是否含有指定的字符。 

    在一个字符串中查找指定的字符,返回被查找到的指定的字符的位置。 

    语法: 

    例子

    SELECT
    SUBSTR (gearbox_type,1,INSTR (gearbox_type, '-',1)-1) AS STF_NAME
    FROM
    T_V_AXLE_INFO
    instr(sourceString,destString,start,appearPosition) 

    instr('源字符串' , '目标字符串' ,'开始位置','第几次出现') 

    其中sourceString代表源字符串; 

    destString代表要从源字符串中查找的子串; 

    start代表查找的开始位置,这个参数可选的,默认为1; 

    appearPosition代表想从源字符中查找出第几次出现的destString,这个参数也是可选的, 默认为1 

    如果start的值为负数,则代表从右往左进行查找,但是位置数据仍然从左向右计算。 

    返回值为:查找到的字符串的位置。

  • 相关阅读:
    EF实现增删改查
    托管代码与非托管代码的区别
    堆、栈以及队列
    C#装箱和拆箱
    Leecode刷题之旅-C语言/python-349两个数组的交集
    Leecode刷题之旅-C语言/python-344反转字符串
    Leecode刷题之旅-C语言/python-217存在重复元素
    Leecode刷题之旅-C语言/python-206反转链表
    Leecode刷题之旅-C语言/python-204计数质数
    Leecode刷题之旅-C语言/python-203移除链表元素
  • 原文地址:https://www.cnblogs.com/zyanrong/p/10766004.html
Copyright © 2011-2022 走看看