首页 > 数据库 > MySQL > 正文

MySQL数据库优化详解

2024-07-24 12:46:50
字体:
来源:转载
供稿:网友

mysql表复制                                                                              

复制表结构+复制表数据

mysql> create table t3 like t1;mysql> insert into t3 select * from t1;

mysql索引                                                                                 

ALTER TABLE用来创建普通索引、UNIQUE索引或PRIMARY KEY索引ALTER TABLE table_name ADD INDEX index_name (column_list)ALTER TABLE table_name ADD UNIQUE (column_list)ALTER TABLE table_name ADDPRIMARY KEY (column_list)Create IndexCREATE INDEX index_name ON table_name (column_list)CREATE UNIQUE INDEX index_name ON table_name (column_list)drop indexDROP INDEX index_name ON talbe_namealter table table dropALTER TABLE table_name DROP INDEX index_nameALTER TABLE table_name DROP PRIMARY KEY

mysql视图                                                                                

创建视图

mysql> create view v_t1 as select * from t1 where id>4 and id<11;Query OK, 0 rows affected (0.00 sec)

view视图的帮助信息

mysql> ? viewALTER VIEWCREATE VIEWDROP VIEW

查看视图

mysql> show tables;

删除视图v_t1

mysql> drop view v_t1;

mysql内置函数                                                                           

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表