1、數據表的增刪改查操作(crud):
對於表:
增:create table XXXX
刪:drop table XXXX
改:alter table XXXX rename to XXXX
查:select * from XXXX
對於行:
增:insert into XXXX(xxxx) values (xxxx)
insert into XXXX set xxxx=xx , xxxx=xx
刪:delete from XXXX where xxxx
改:update table set xxxx=xxxx where xxxx=xxxx
查:select xxxx from XXXX
對於列:
增:alter table XXXX add xxxx()
刪:alter table XXXX drop xxxx
改:alter table XXXX change xxxx xxxx xxxx
alter table XXXX modify xxxx xxxx
查:show columns from XXXX
2、運算符與函數
字符函數
Concat() select concat('hha','-','hdf')
Concat_ws() select concat_ws('=','A','B','C')
Format() select format(125060.752,2)
Lower() select lower('HIIHO')
Upper() select upper('fsfds')
Left() select left('fsfds',2)
Right() select right('fsfds',2)
Length() select length(' fsfds ')
Ltrim() select ltrim(' fsfds ')
Rtrim() select rtrim(' fsfds ')
Trim() select trim(' fsfds ')
select trim(leading '?' from ' fs?fds ')
select trim(trailing '?' from ' fs?fds ')
select trim(both '?' from ' fs?fds ')
Substring() select substring(' fsfds ',2,3)
select substring(' fsfds ',2)
Like select 'myufsd' like 'm%'
select * from test where first_name like '%1%%' escape '1'
%代表任意個字符
_代表任意一個字符
Replace() select replace('fsgasgsfa','s','t')
3、數值運算符
Div 整數除法
4、比較運算符合函數
Not between and
Not in
5、時間和日期函數
Now()
Curdate()
Curtime()
Date_add()
Datediff()
Date_format()
6、信息函數
Connection_id()
Datebase()
Last_insert_id()
User()
Version()
7聚合函數
。。。
8、加密函數
Md5()
Password()