Oracle學習筆記(一)建站知識
導讀:1建站知識最近需要用的oracle,所以大家好好的學習下基礎并整理下資料,希望能幫助到需要的朋友。網站優化seo培訓網站seo優化。
一.基本的查詢語句,特殊符號||。制定列的別名AS,唯一標示distinct
1.字符連接符“||”與“+”符
oracle:select 列名||'111111111111111' from 表名sql:select 列名+'111111111111111' from 表名T
2“AS”符號oracle:select 列名 as 新列名 from 表名 (空格,不能有as)新表名sql:select 列名 as 新列名 from 表名T as(as可有可無) 新表名
二.數據排序與數據過濾查詢與sql相同
in ,like, is null,between ... seo網站優化軟件and ...,and ,or
order by 列名 asc/desc 默認升序
三.單行函數(single-row functions) Character字符函數、Number數字函數、Date日期函數、Conversion轉換函數、General通用函數
1.字符函數:Case字符處理函數包括:LOWER、UPPER、INITCAPlower('SQL')->sql 把大寫變小寫upper('sql')->SQL 把小寫變大寫initcap('sql course')->Sql Course 首字母大寫
Character操作函數
字符拼接concat('Hello','World')->HelloWorld
字符截取從左邊第一個截取5個字符substr('HelloWorld',1,5)->Hello
在sql中用left()函數
1、left() LEFT (<character_expression>, <integer_expression>)返回character_expression 左起 integer_expression 個字符。
列: left('helloworld',5)—>hello
從右邊數第五個截取5個字符substr('HelloWorld',-5,5)->World
在sql中用right()函數
1、right() RIGHT(<character_expression>, <integer_expression>)返回character_expression 左起 integer_expression 個字符。
列: right('helloworld',5)—>world
計算長度length('HelloWorld')->10
查找字符w的位置instr('HelloWorld','w')->6
2.charindex()返回字符串中某個指定的子串出現的開始位置。CHARINDEX (<'substring_expression'>, <expression>)其中substring _expression 是所要查找的字符表達式,expression 可為字符串也可為列名表達式。如果沒有發現子串,則返回0 值。此函數不能用于TEXT 和IMAGE 數據類型。
取出10個字符不夠以字符“*”左邊填充lpad('hello',10,'*')->*****hello
取出10個字符不夠以字符“*”右邊填充rpad('hello'10,'*')->hello*****
從字符中刪除首個字母trim('H' from 'HelloWorld')->elloWorld
2.數字函數:round、trunc、modround(45.926,2)->45.923
trunc(45.926,2)->45.92
mod(16,3)->1求余數
3.日期函數
獲取系統當前時間sql:select getdate();oracle: select sysdate from dual;
計算日期差:months_between(sysdate,to_date('2010-11-29','yyyy-MM-dd'))
聲明: 本文由我的SEOUC技術文章主頁發布于:2023-05-23 ,文章Oracle學習筆記(一)建站知識主要講述學習筆記,標簽,Oracle學習筆記(一)建站知識1網站建設源碼以及服務器配置搭建相關技術文章。轉載請保留鏈接: http://www.bifwcx.com/article/web_5861.html