关于SQLITE的加密

Posted by & filed under DATABASE.

1)http://wenku.baidu.com/view/e3adf5707fd5360cba1adb0b.html 这篇文章,
2)以及 http://sourceforge.net/projects/wxsqlite/ 源码提供者!
3)还有,强烈推荐下 《sqlite加密设计的缺陷与改进》 里面提到的问题本人没有重视,还请大家努力。 

http://www.eoeandroid.com/forum.php?mod=viewthread&tid=180140

Other:
1)http://blog.csdn.net/bigdavidwli007/article/details/7091866
2)http://sqlcipher.net/about/…

sql server 2008 sa账户无法登录,错误:233

Posted by & filed under SQLSERVER.

http://hi.baidu.com/cive/blog/item/bd4e8e82a714d0b26c81198d.html

重新安装了sql server 2008,发现sa账户无法登录,错误是233。

网上找了很多帖子,

设置了“SQL   Server和Windows身份验证模式”,

也设置了sa“启用”,

也重启了N次,

都不行,

偶然看到一个办法,一试就好了。

如下:

 

用Windows身份验证登录,执行SQL命令:

ALTER LOGIN sa WITH PASSWORD=’新密码’

搞定,现在终于可以用sa登录SQL管理器了。

Recursive Relationships

Posted by & filed under DATABASE, ORACLE, SQLSERVER.

Recursive relationships: relationships exist between entity instances of the same type.

One-to-one: If we were to track which employees were married to other employees, we would expect each to be married to either zero or one other employee at any …

多对多必须通过单独的一张表来表示

Posted by & filed under DATABASE, ORACLE, SQLSERVER.

如班级和教师的关系由三张表来表示:班级表,教师 及 班级教师表

In particular, the logical model does not contain any many-to-many relationships. There is a simple rationale for this difference – relational databases do not directly support many-to-many relationships, so they must be transformed using an intersection entity.…

About Count

Posted by & filed under ORACLE, SQLSERVER.

select count(*) FROM [AdventureWorks].[Person].[Contact]
返回表中所有的记录的个数

select COUNT(MiddleName) from [AdventureWorks].[Person].[Contact]
返回字段中,值非空的记录的个数(重复的也算进去的) 

select COUNT(distinct MiddleName) from [AdventureWorks].[Person].[Contact]
返回字段中不重复且非空的记录的个数

Result:
19972
11473
70…

Cursors in SQL

Posted by & filed under DATABASE, ORACLE, SQLSERVER.

SQL was designed as a set-oriented processing language. Some business rules( or poor physical design) require performing actions on row-by-row basis. Consider the following example:
. Increase the price of books <=$15 by 15%
. Decrease the price of books …

Basic Rules of Normalization

Posted by & filed under DATABASE, ORACLE, SQLSERVER.

Without going into a dissertation on data modeling(itself a subject of many full-length treatises), tables should follow basic rules of normalization:

Avoid duplicate data, avoid repeating groups in tables, and only put data in tables where the information is directly

The logical processing of the Select statement

Posted by & filed under SQLSERVER.

CREATE TABLE Loans (
 loan_nbr INT NOT NULL ,
 customer_nbr INT NOT NULL,
 loan_date DATETIME NOT NULL,�
 loan_amount DECIMAL(15, 2) NOT NULL,
 loan_type CHAR(1) NOT NULL,
 CONSTRAINT ck_loan_type
 CHECK (loan_type IN(‘P’,’B’)), — P = Personal; –B=Business
 CONSTRAINT pk_loans
 PRIMARY KEY(loan_nbr));…

SQL Server中行列转换 Pivot UnPivot

Posted by & filed under SQLSERVER.

PIVOT用于将列值旋转为列名(即行转列),在SQL Server 2000可以用聚合函数配合CASE语句实现

PIVOT的一般语法是:PIVOT(聚合函数(列) FOR 列 in (…) )AS P

完整语法:

table_source

PIVOT(

聚合函数(value_column)

FOR pivot_column

IN(<column_list>)

)

 

UNPIVOT用于将列明转为列值(即列转行),在SQL Server 2000可以用UNION来实现

完整语法:

table_source

UNPIVOT(

value_column

FOR pivot_column

IN(<column_list>)

)

 

注意:PIVOT、UNPIVOT是SQL Server 2005 的语法,使用需修改数据库兼容级别
 在数据库属性->选项->兼容级别改为   90

 

典型实例

一、行转列