上一页 1 2 3 4 5 6 7 8 ··· 11 下一页
摘要: 备份数据表结构+数据 mysqldump -u root -p db1 > db1.sql 只备份数据表结构 mysqldump -u root -p -d db1 > db1.sql 还原数据表 mysqldump -u root -p db2 < db1.sql 阅读全文
posted @ 2018-03-25 17:13 Claire_xu 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 1 在 https://dev.mysql.com/downloads/mysql/ 上下载mysql压缩包 2 解压,并把bin目录加入环境变量 3 初始化,完成后会在mysql根目录下生成data目录 mysqld --initialize-insecure 4 启动mysql服务器: mysq 阅读全文
posted @ 2018-03-25 09:33 Claire_xu 阅读(660) 评论(0) 推荐(0) 编辑
摘要: 作用: - 约束 - 加速查找 普通索引:加速查找 create index 索引名称 on 表名(列名,) drop index 索引名称 on 表名 主键索引:加速查找+不能为空+不能重复 create unique index 索引名称 on 表名(列名) drop unique index 阅读全文
posted @ 2018-03-15 18:05 Claire_xu 阅读(130) 评论(0) 推荐(0) 编辑
摘要: date_format函数 阅读全文
posted @ 2018-03-15 17:45 Claire_xu 阅读(263) 评论(0) 推荐(0) 编辑
摘要: 视图 # 视图也是一张表,但在data文件里只有表结构,没有表数据 # 不建议使用,扩展性差,程序需改变时,依赖的视图也要改变 # 视图牵涉到多张表时,视图中的记录不能修改。 create view course2teacher as select * from course inner join 阅读全文
posted @ 2018-03-15 17:22 Claire_xu 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 创建本地账号 create user 'egon1'@'localhost' identified by '123'; # mysql -uegon1 -p123 创建远程账号 create user 'egon2'@'192.168.31.10' identified by '123'; # my 阅读全文
posted @ 2018-03-15 14:08 Claire_xu 阅读(261) 评论(0) 推荐(0) 编辑
摘要: 内连接 select * from employee inner join department on employee.dep_id = department.id 左连接 在内连接的基础上保留左表记录 select * from employee left join department on 阅读全文
posted @ 2018-03-14 11:14 Claire_xu 阅读(429) 评论(0) 推荐(0) 编辑
摘要: select * from employee where name regexp '^jin' select * from employee where name regexp '^jin.*(g|n)$' select * from employee where name = 'a_' # _代表 阅读全文
posted @ 2018-03-14 11:04 Claire_xu 阅读(1609) 评论(0) 推荐(0) 编辑
摘要: 语法顺序: select distinct 字段1,字段2,字段3 from 库.表 where 条件 group by 分组条件 having 过滤 # 执行顺序的话,到这步会返回运行select语句,之后再运行order by order by 排序字段 limit n; # 限制打印到屏幕上的 阅读全文
posted @ 2018-03-14 11:02 Claire_xu 阅读(340) 评论(0) 推荐(0) 编辑
摘要: 多对一 : 只需设个外键 外键变种之一对一:普通外键关联的表是一对多关系,如果外键上再加上唯一索引,表就会变成一对一关系。 外键变种之多对多: 阅读全文
posted @ 2018-03-13 17:49 Claire_xu 阅读(173) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 11 下一页