您的位置:首页 > 编程语言 > PHP开发

PHP特级视频教程 笔记心得  第十五集 mysql调优,mysql优化 MySQL基础操作(一)

2012-08-05 22:26 1036 查看
1 mysql基础操作

1.1 mysql表复制

mysql复制表

create table t3 like t1;

insert into t3 select * from t1

1.2 mysql索引(尽量大写,alter为推荐写法。)

create index

alter table table_name add index index_name(column_list)

alter table table_name add unique(column_list)

alter table table_name add primary key(column_list)

drop index

drop index index_name on table_name

alter table table index

alter table table_name drop index

查看索引

show index from t1

修改字段 alter table t1 modify id int unsigned not null auto_increment;

1.3 mysql视图

其实是一种中间表

? view 帮助来查看,mysql中用问号来查看帮助信息。

create view v as

select * from t1;

删除视图 drop view t1;

1.4 mysql内置函数

concat() //连接字符串

lcase() //转换成小写

ucase() //转换成大写

length() //string的长度

ltrim() 去除前段空格

rtrim() 去除后端空格

repeat() 重复count次

replace(str,serace_replace_str)替换

substring(str,position,length) 截取

space(count) 生产count个空格
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐