oracle 中的 CONCAT,substring ,MINUS 用法
发布日期:2025-04-29 13:03:37 浏览次数:20 分类:精选文章

本文共 1152 字,大约阅读时间需要 3 分钟。

?????????????????????????????????????????????????????????

1. CONCAT()??

CONCAT()?????????????????????????CONCAT()????????????

  • MySQL/Oracle??? CONCAT(???1, ???2, ...)?
  • SQL Server??? + ????

???

  • MySQL/Oracle?

    SELECT CONCAT(region_name, store_name) FROM Geography WHERE store_name = 'Boston';

    ???EastBoston

  • Oracle?

    SELECT region_name || ' ' || store_name FROM Geography WHERE store_name = 'Boston';

    ???East Boston

  • SQL Server?

    SELECT region_name + ' ' + store_name FROM Geography WHERE store_name = 'Boston';

    ???East Boston

2. SUBSTR()??

SUBSTR()??????????????????????????SUBSTR()????????????

  • MySQL??? SUBSTR(str, pos) ? SUBSTR(str, pos, len)?
  • SQL Server??? SUBSTR(str, pos, len)?

???

  • MySQL?

    SELECT SUBSTR(store_name, 3) FROM Geography WHERE store_name = 'Los Angeles';

    ???s Angeles

  • SQL Server?

    SELECT SUBSTR(store_name, 2, 4) FROM Geography WHERE store_name = 'San Diego';

    ???an D

3. MINUS??

MINUS???????????????????????

???

SELECT Date FROM Store_Information MINUS SELECT Date FROM Internet_Sales;

???

  • Store_Information ???????Jan-05-1999, Jan-08-1999
  • Internet_Sales ???????Jan-07-1999

?????Jan-05-1999, Jan-08-1999

MINUS??????????????????????????????????

上一篇:Oracle 中的 decode
下一篇:oracle where 条件的执行顺序分析1

发表评论

最新留言

能坚持,总会有不一样的收获!
[***.219.124.196]2026年06月13日 01时51分49秒