SQL之總結(二)

2022-02-23 13:33:22 字數 999 閱讀 9958

4.關於取兩個日期之間的年份:

ceil(months_between(sysdate, c.sendtime)/12) worktime

ceil(n) 取大於等於n的最小整數

floor(n) 取小於等於n的最大整數

5.如果某個欄位為空值則以 '$nbsp'代替

nvl(c.phone,'18677777777') phone

nvl(c.phone,' ') phone

6.關於取**url位址去掉前面的'/'的問題

substr(c.gimg, 2,length(c.gimg)-1) gimg

7.關於取日期轉化為char型別

8.加入多個列表中沒有某一列,我相加如某一列的話並另初始值都為1的話,則如下:

如:

SQL學習總結(二)

select 語句加where子句 條件限制 1.limiting rows using a selection select from emp where deptno 30 select from emp where ename king 2.comparison conditions sele...

SQL注入總結(二)

手工注入的大致思路 判斷是否存在注入,注入是字元型還是數字型 猜解sql查詢語句中的字段數 order by 2 確定顯示的字段順序 union select 1,2 獲取當前資料庫 union select 1,database 獲取資料庫中的表 xx union select 1,table n...

原創 SQL總結(二)

有時候在搜尋時需要指定搜尋範圍,過濾掉一些不需要輸出的資料 select prod name,prod id,prod price from products where prod price 3.49 表示輸出 為3.49的所有行的name,id,price項。注意,如果要使用排序,那麼order...