04 2015 档案

MySQL、You are using safe update mode
摘要:MySQL默认模式是sql_safe_updates=1的。在这个模式下不管你是update还是delete一行where 条件都要指定主键。如果where条件只出现的不是主键就会出错。例子: set sql_safe_updates =1;--开始安全更新、这个是我这个例子的前提。 --第一步... 阅读全文

posted @ 2015-04-30 12:49 蒋乐兴的技术随笔 阅读(875) 评论(0) 推荐(0) 编辑

SQL 设计心得、逗号分隔列表
摘要:第一: 在开始编码前、主要关注数据库里要保存什么样的数据,以级最佳的数据组织方式和内在关联方式。第二: 使用你所知的数据库特性尽可能高效的实现数据管理。如正确的索引、数据库类型、高效的select!-------------------------------------------------... 阅读全文

posted @ 2015-04-29 22:57 蒋乐兴的技术随笔 阅读(716) 评论(0) 推荐(0) 编辑

MYSQL @、@@、@x
摘要:说明一: @var这种形式表示的是用户自定义的变量。说明二: @@var这种形式表示的是系统变量、它又可以分为两种一种是全局(@@global)的一种是会话(@@session)的。说明三: MYSQL中会话级的变量是可以直接用的、是可以事先不定义、就直接用的。 如: sele... 阅读全文

posted @ 2015-04-26 09:44 蒋乐兴的技术随笔 阅读(555) 评论(0) 推荐(0) 编辑

SQL Server
摘要:create table persons(Name nvarchar(32) not null); goinsert into persons(Name) values('张三'),('李四'),('王五'); godeclare @i as int =1;--循环计数器 declare @rows... 阅读全文

posted @ 2015-04-13 18:18 蒋乐兴的技术随笔 阅读(133) 评论(0) 推荐(0) 编辑

建设供内网访问的网站
摘要:第一步: 配置IIS编辑绑定 第二步: 绑定IP 第三步: 测试 阅读全文

posted @ 2015-04-13 13:55 蒋乐兴的技术随笔 阅读(158) 评论(0) 推荐(0) 编辑

MySQL 关闭子表的外键约束检察
摘要:准备: 定义一个教师表、一个学生表;在学生表中引用教师表IDcreate table teachers(teacherID int not null auto_increment primary key,teacherName varchar(8));create table students(s... 阅读全文

posted @ 2015-04-12 17:25 蒋乐兴的技术随笔 阅读(1511) 评论(0) 推荐(0) 编辑

SQL Server Mysql primary key可更新性分析
摘要:SQL Server: 一般来说SQL Server 中表的主键是支持更新操作的、但是如果这个主键是由identity(1,1)这类的方式生成的话它是不可更新的。Mysql : Mysql 中表的主键是支持更新操作的不管它有没有auto_increment 这一特性。 阅读全文

posted @ 2015-04-12 16:46 蒋乐兴的技术随笔 阅读(281) 评论(0) 推荐(0) 编辑

SQL Server 排名函数实现
摘要:在SQL Server 中有四大排名函数分别是:1、row_number()2、ntile()3、rank()4、dense_rank()-------------------------------------------------------------------------为了方便演示我们... 阅读全文

posted @ 2015-04-08 17:44 蒋乐兴的技术随笔 阅读(411) 评论(0) 推荐(0) 编辑

MySQL select
摘要:SQL_CACHE: 期望查询从Query_Cache 中取值、而不是去表中查找。当然如果查询缓存中没有的话它就要从表中找了。SQL_NO_CACHE: 不允许查询从缓存中取值、而是直接从表中查找。SQL_BUFFER_RESULT: 把查询结果缓存起来、下次好用。 阅读全文

posted @ 2015-04-06 23:14 蒋乐兴的技术随笔 阅读(117) 评论(0) 推荐(0) 编辑

MySQL 数据显示宽度
摘要:例子: 把int 的显示宽度设置为 3 create table t(x int(3) zerofill); insert into t(x) values(1); select x from t; 从结果中可以看出 x 的输出被格式化成了三位!但是如果我们插入一个四位数会怎么样呢? ... 阅读全文

posted @ 2015-04-04 11:03 蒋乐兴的技术随笔 阅读(1343) 评论(0) 推荐(0) 编辑

MySQL zerofill 的用法
摘要:creata table t(x int(6) zerofill,y int); insert into t(x,y) values(1,1); select x,y from t; 阅读全文

posted @ 2015-04-04 10:54 蒋乐兴的技术随笔 阅读(712) 评论(0) 推荐(0) 编辑

MySQL Select 优化
摘要:准备: create table t(x int primary key,y int unique,z int); insert into t(x,y,z) values(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),(6,6,6),(7,7,7),(8,8,8)... 阅读全文

posted @ 2015-04-03 09:05 蒋乐兴的技术随笔 阅读(791) 评论(0) 推荐(0) 编辑

SQL Server 多表删除
摘要:第一步: 建表 create table t1(x int, y int); create table t2(x int, y int); go insert into t1(x,y) values(1,2),(2,3),(3,4),(4,5),(5,6); insert into t2... 阅读全文

posted @ 2015-04-02 23:56 蒋乐兴的技术随笔 阅读(8083) 评论(0) 推荐(0) 编辑

SQL Server Mysql 对null值理解的不同
摘要:在说到对null值的理解主要是用unique来体现的。也是说null在unique约束看来是一个值还是多个值的问题。还是开始实验吧。MYSQL create table t(x int ,constraint ix_unique_x unique index (x)); insert into ... 阅读全文

posted @ 2015-04-02 15:49 蒋乐兴的技术随笔 阅读(262) 评论(0) 推荐(0) 编辑

SQL Server 数据库备份到域中别的机器上
摘要:backup database dbName to disk ='\\SV2\D\dbbackup\dbName.bak' with init,compression; 阅读全文

posted @ 2015-04-02 14:15 蒋乐兴的技术随笔 阅读(187) 评论(0) 推荐(0) 编辑

SQL Server 中同时操作的例子:
摘要:在SQL 中同一逻辑阶段的操作是同时发生的。先有一个例子做为带入:declare @x as int =1;declare @y as int =2;set @x=@y;set @y=@x;select @x,@y;go-- 最后select 的结果是 x=2、y=2!这个结果在大家看来、来的是这么... 阅读全文

posted @ 2015-04-01 23:25 蒋乐兴的技术随笔 阅读(217) 评论(0) 推荐(0) 编辑

mysql alter table
摘要:准备: create table t(x int,y int); 用法 1: 修改列的数据类 alter table t modify column y nvarchar(32); 用法2: 给表加一列 alter table t add column z int; 用法3: 删除... 阅读全文

posted @ 2015-04-01 22:52 蒋乐兴的技术随笔 阅读(250) 评论(0) 推荐(0) 编辑

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示