排序
MySql三种避免重复插入数据的方法
前言 MySql 在存在主键冲突或唯一键冲突的情况下,根据插入方式,一般有以下三种插入方式避免错误。 insert ignore。 replace into insert on duplicate key update insert ignore insert ignor...
MySQL创建用户与授权方法
注:我的运行环境是widnows xp professional + MySQL5.0 一, 创建用户: 命令:CREATE USER 'username'@'host' IDENTIFIED BY 'password'; 说明:username - 你将创建的用户名, host - 指定该用户...
mysql 临时表 cann’t reopen解决方案
当你创建临时表的时候,你可以使用temporary关键字。如: create temporary table tmp_table(name varchar(10) not null,passwd char(6) not null); 或 create temporary table if not exists s...
MySQL中可为空的字段设置为NULL还是NOT NULL
经常用mysql的人可能会遇到下面几种情况: 1、我字段类型是not null,为什么我可以插入空值 2、为什么not null的效率比null高 3、判断字段不为空的时候,到底要用 select * from table where co...
MySQL组合索引与最左匹配原则详解
前言 之前在网上看到过很多关于mysql联合索引最左前缀匹配的文章,自以为就了解了其原理,最近面试时和面试官交流,发现遗漏了些东西,这里自己整理一下这方面的内容。 什么时候创建组合索引? ...












