mysql
建表
create table class(
? id INT AUTO_INCREMENT,
? name varchar(32) UNIQUE,
? age varchar(32) NOT NULL
);
該表
alter table 表名 add 字段名 類(lèi)型(長(zhǎng)度) [約束];?-- 添加列
alter table 表名 modify 字段名 類(lèi)型(長(zhǎng)度) [約束];?-- 修改列的類(lèi)型長(zhǎng)度及約束
alter table 表名 change 舊字段名 新字段名 類(lèi)型(長(zhǎng)度) [約束];?-- 修改列表名
alter table 表名drop 字段名;-- 刪除列
alter table 表名 character set 字符集; -- 修改表的字符集
rename table 表名 to 新表名; -- 修改表名
增刪改查
www.cnblogs.com/mofujin/p/11355517.html
select distinct * from '表名' where '限制條件' group by '分組依據(jù)' having '過(guò)濾條件' order by limit '展示條數(shù)'
insert into 表(字段名1,字段名2..) values(值1,值2..);-- 向表中插入某些列
update 表名 set 字段名=值,字段名=值... where 條件; -- 只改符合where條件的行
delete from 表名 where 條件 -- 刪除符合 where條件的數(shù)據(jù)
這些就是常用的精髓了?
剩下的就是要用到表連接? ?子查詢? ?還有內(nèi)置函數(shù)? 這些全都是基礎(chǔ)的變種