第一部分:基础知识
索引
官方介绍索引是帮助MySQL高效获取数据的数据结构。笔者理解索引相当于一本书的目录,通过目录就知道要的资料在哪里, 不用一页一页查阅找出需要的资料。
唯一索引(unique index)
强调唯一,就是索引值必须唯一。
创建索引:
create unique index 索引名 on 表名(列名);
alter table 表名 add unique inde...
分类:
数据库 时间:
2015-01-09 19:26:37
阅读次数:
328
mysql索引类型normal,unique,full text,spatial...
分类:
数据库 时间:
2015-01-09 19:21:32
阅读次数:
306
SET NOCOUNT ON;DECLARE @TestTable TABLE ( RowID INT IDENTITY PRIMARY KEY CLUSTERED, Name VARCHAR(9) NOT NULL UNIQUE, Age TINYINT NULL, r...
分类:
其他好文 时间:
2015-01-09 18:50:33
阅读次数:
306
The problem:Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.My analysis:The problem is easy at some extent,...
分类:
其他好文 时间:
2015-01-09 12:15:07
阅读次数:
108
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d =
target? Find all unique quadruplets in the array which gives the sum of target.
Note:
Element...
分类:
其他好文 时间:
2015-01-09 09:17:54
阅读次数:
180
mysql的key和index多少有点令人迷惑,这实际上考察对数据库体系结构的了解的。1 key 是数据库的物理结构,它包含两层意义,一是约束(偏重于约束和规范数据库的结构完整性),二是索引(辅助查询用的)。包括primary key, unique key, foreign key 等。 pri....
分类:
数据库 时间:
2015-01-08 17:10:15
阅读次数:
151
题目:
Follow up for "Unique Paths":
Now consider if some obstacles are added to the grids. How many unique paths would there be?
An obstacle and empty space is marked as 1 and 0 respectively...
分类:
编程语言 时间:
2015-01-08 15:29:48
阅读次数:
162
u Mysql数据库的优化技术对mysql优化时一个综合性的技术,主要包括a: 表的设计合理化(符合3NF)b: 添加适当索引(index) [四种: 普通索引、主键索引、唯一索引unique、全文索引]c: 分表技术(水平分割、垂直分割)d: 读写[写: update/delete/add]分离e...
分类:
数据库 时间:
2015-01-08 09:30:51
阅读次数:
230
REPLACE的运行与INSERT很相似。只有一点例外,假如表中的一个旧记录与一个用于PRIMARY
KEY或一个UNIQUE索引的新记录具有相同的值,则在新记录被插入之前,旧记录被删除。
注意,除非表有一个PRIMARY KEY或UNIQUE索引,否则,使用一个REPLACE语句没有意义。该
语句会与INSERT相同,因为没有索引被用于确定是否新行复制了其它的行。
所有列的值均取自...
分类:
数据库 时间:
2015-01-07 18:50:11
阅读次数:
151
1.数组去重/*方法一: 1,'1' 会被认为是相同的; 所有hash对象,如:{x;1},{y:1}会被认为是相同的 //10ms */Array.prototype.unique=function(){ var newArr=[],obj={}; for(var i=0,len=th...
分类:
编程语言 时间:
2015-01-07 16:44:39
阅读次数:
173