All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
学习PHP动态网页技术收集的几个有用函数_php资料_编程技术
Delphi浏览sql server数据库中的信息
ASP.NET将Web站点下的绝对路径转换为虚拟路径_[Asp.Net教程]
XML学习笔记(四)Schema介绍篇_[XML教程]
你必须知道的.NET之对接口和抽象类_.net资料_编程技术
PHP+MySQL分页显示示例分析_[PHP教程]
AspNet2.0页面生命周期_[Asp.Net教程]
通过Web,Services上传和下载文件_[Asp.Net教程]
Visual,Studio2005发布问题解决办法_[Asp.Net教程]
ASP.NET生成静态页面实现方法_[Asp.Net教程]
Reading number is top 10 pictures
Lewd,it is too lewd.
2012 national geographic daily picture6
More attractive than sora aoi2
The money of more than 100 countries and regions2
大四女生借债隆胸成功
Average female college students1
Fender Bender that so horrifying1
狗狗与主人神同步1
西游日记1
yy365网站上的美女3
Download software ranking
C++编程教程第三版
DreamWeaver8
变速齿轮3.26
Tram sex maniac 2 (H) rar bag10
C++教程第四版
Dance with duck(male prostitution)
Boxer vs Yellow4
JSP+Ajax Web development typical examples
Unix video tutorial4
Tram sex maniac 2 (H) rar bag6
归海一刀 published in(发表于) 2014/2/3 6:39:55 Edit(编辑)
SQL操作全集(部分是Mssql语句,不在access中使用)_[SQL Server教程]

SQL操作全集(部分是Mssql语句,不在access中使用)_[SQL Server教程]

SQL操作全集(部分是Mssql语句,不在access中使用)_[SQL Server教程]
SQL分类:
DDL—数据定义语言(CREATE,ALTER,DROP,DECLARE)
DML—数据操纵语言(SELECT,DELETE,UPDATE,INSERT)
DCL—数据控制语言(GRANT,REVOKE,COMMIT,ROLLBACK)

首先,简要介绍基础语句:
1、说明:创建数据库
CREATE DATABASE database-name
2、说明:删除数据库
drop database dbname
3、说明:备份sql server
--- 创建 备份数据的 device
USE master
EXEC sp_addumpdevice ’disk’, ’testBack’, ’c:\mssql7backup\MyNwind_1.dat’
--- 开始 备份
BACKUP DATABASE pubs TO testBack
4、说明:创建新表
create table tabname(col1 type1 [not null] [primary key],col2 type2 [not null],..)
根据已有的表创建新表:
A:create table tab_new like tab_old (使用旧表创建新表)
B:create table tab_new as select col1,col2… from tab_old definition only
5、说明:删除新表drop table tabname
6、说明:增加一个列
Alter table tabname add column col type
注:列增加后将不能删除。DB2中列加上后数据类型也不能改变,唯一能改变的是增加varchar类型的长度。
7、说明:添加主键: Alter table tabname add primary key(col)
说明:删除主键: Alter table tabname drop primary key(col)
8、说明:创建索引:create [unique] index idxname on tabname(col….)
删除索引:drop index idxname
注:索引是不可更改的,想更改必须删除重新建。
9、说明:创建视图:create view viewname as select statement
删除视图:drop view viewname
10、说明:几个简单的基本的sql语句
选择:select * from table1 where 范围
插入:insert into table1(field1,field2) values(value1,value2)
删除:delete from table1 where 范围
更新:update table1 set field1=value1 where 范围
查找:select * from table1 where field1 like ’%value1%’ ---like的语法很精妙,查资料!
排序:select * from table1 order by field1,field2 [desc]
总数:select count * as totalcount from table1
求和:select sum(field1) as sumvalue from table1
平均:select avg(field1) as avgvalue from table1
最大:select max(field1) as maxvalue from table1
最小:select min(field1) as minvalue from table1



添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.