1.添加
INSERT INTO USER(NAME,AGE,SEX,ADDRESS) VALUES('張三',12,'男','武漢');
2.刪除
DELETE FRON USER WHERE ID=1;
3.修改
UPDATE USER SET NAME='李四';
4.查詢
SELECT * FROM USER ;
5.count()、 avg()、 sum()、 max()、 min()函數
select count(1),avg(age),sum(age),max(age),min(age) as con from user;
-- 支持分組
select name,count(1) from user group by name;
6.分頁
mysql的分頁 當前頁currentpage 每頁顯示多少條pagesize
select * from user LIMIT 0,10;
|--參數1 從第幾條開始顯示,但不包含這一條
|--參數2 一共顯示多少條數據
select * from user LIMIT (currentpage-1)*pagesize,pagesize;
7.過濾
select DISTINCT name from uaer;