为了快速复习mysql语法及知识,特整理一下知识点(适合曾经学过,但可能已经全部忘了的,请注意实践中才能真正学习)
创建数据库
create database oku
删除数据库
drop database oku
选择数据库
use oku
数据类型
数值类型:
int,float,double等等
字符类型:
chat,varchar,texr等等
日期类型:
dat,time,year,datetime,timestamp
创建数据表
create table obiao( name chat age int)
删除数据表
drop table obiao #插入数据 insert into obiao (name,age) value ('david',21)
查询数据
select name from obiao
where子句
select name from obiao where age=18
更改表中数据
UPDATE obiao set name='davidking' where age=21
删除表中数据
DELECT from obiao where age=19
like子句
select name from obiao where name like 'david'
union子句
select name from obiao where name like 'david' UNION select name from obiao where age=18
排序函数
select * from obiao ORDER BY age ASC
分组函数
select * from obiao GROUP BY age
表的连接
select a.name,b.name from obiao1 a INNER JOIN obiao2 b on a.name=b.name
NULL的使用
包括IS NULL 和IS NOT NULL
正则表达式
包括^和$和[...]和{m,n}和*和+和|和.和[^...]
事务处理
BEGIN ROLLBACK COMMIT
alter使用
alter table obiao engine=myisam
索引创建
create index indexname on obiao (name)
临时表
**create tamporary table obiao( nama chat(30) ) **
复制表
show create table obiao create table 'clobiao' insert into clobiao()
元数据
序列
create table insert ()
#####函数 字符串函数 数字函数 日期函数 高级函数 #####运算符 ** 算术运算符 +和-和*和/和% 比较运算符 ><=等等 逻辑运算符 !和and和or和xor 位运算符 &和|和^和!和<<和>> **
以下为后续添加的
limit 限制列
offset 跳过列
ifnull 判断是否为null
使用DISTINCT去除重复值
as author_id为id