亚洲视频二区_亚洲欧洲日本天天堂在线观看_日韩一区二区在线观看_中文字幕不卡一区

公告:魔扣目錄網為廣大站長提供免費收錄網站服務,提交前請做好本站友鏈:【 網站目錄:http://www.430618.com 】, 免友鏈快審服務(50元/站),

點擊這里在線咨詢客服
新站提交
  • 網站:51998
  • 待審:31
  • 小程序:12
  • 文章:1030137
  • 會員:747

同步滾動:關

學數據庫這么久了?SQL數據庫基礎函數都搞懂了嗎?安排

 

SQL的基礎函數

lower

select lower(name) from students #將students表的所有name字段的數據全都轉為小寫打印出來

upper

select upper(name) from students #將students表的所有name字段的數據全都轉為大寫打印出來

length

select length(name) from students #將students表的所有name字段的數據的長度打印出來

substr

select substr(name,1,3) from students; #name字段從1的位置向后截取3位打印出來   例如David -->Dav
select substr(name,2,3) from students; #name字段從2的位置向后截取3位打印出來   例如David -->avi

注意:sql的下標是從1開始

concat

select concat(name,'123') from students; #將students表的所有name字段的數據后面拼接123打印出來 例如David -->David123

replace

select replace(name,'a','666') from students; #將students表的所有name字段的數據中的a替換為666 例如David -->D666vid

ifnull

select ifnull(hobby,'學習') from students #判斷,如果hobby字段的值是null的用學習替換

round & ceil & floor

select round(score) from students #四舍五入取整

select round(score,1) from students #四舍五入,保留一位小數

select ceil(score) from students #向上取整 7.1 --> 8

select floor(score) from students #向下取整 7.9 --> 7

now

select now() #現在的年與日,時分秒

select curdate() #現在的年月日

select curtime() #現在的時分秒

year & month & day

select year(now()) #取現在的年

select month(now()) #取現在的月

select day(now()) #取現在的日

hour()時&minute()分&second()秒

select hour(now()) #取現在的時

select minute(now()) #取現在的分

select second(now()) #取現在的秒

標簽: [數據庫]

分享到:
標簽:數據庫 SQL
用戶無頭像

網友整理

注冊時間:

網站:5 個   小程序:0 個  文章:12 篇

  • 51998

    網站

  • 12

    小程序

  • 1030137

    文章

  • 747

    會員

趕快注冊賬號,推廣您的網站吧!
最新入駐小程序

數獨大挑戰2018-06-03

數獨一種數學游戲,玩家需要根據9

答題星2018-06-03

您可以通過答題星輕松地創建試卷

全階人生考試2018-06-03

各種考試題,題庫,初中,高中,大學四六

運動步數有氧達人2018-06-03

記錄運動步數,積累氧氣值。還可偷

每日養生app2018-06-03

每日養生,天天健康

體育訓練成績評定2018-06-03

通用課目體育訓練成績評定