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

Reading number is top 10 articles
初学来看:动态网页制作技术PHP的变量类型_php资料_编程技术
第二篇:使用Visual,Studio,2008进行数据层开发_[Asp.Net教程]
轻量级的Ajax解决方案——DynAjax的JQuery版_[AJAX教程]
C#中break语句的使用方法
在C#中运用SQLDMO备份和恢复Microsoft,SQL,Server数据库_[Asp.Net教程]
Php高手带路--问题汇总解答_[PHP教程]
使用SQL Server索引视图来提高性能_[SQL Server教程]
GDI+ 绘制折线图分析网站流量
PHP和MySQL基础教程(三)_[PHP教程]
delphi类中的方法是用实例-方法
Reading number is top 10 pictures
Household design comfortable contracted
开始让人感动,后来......
Summer is most suitable for young people to travel in China3
The money of more than 100 countries and regions4
mythology hero1
Discharge accidentally Actresses by the breast1
机器人也有性生活吗?
Hunan province aizhai super-large suspension bridge open to traffic and 4 world first2
Beautiful vacuum girl2
Ashlynn Brooke show proud chest measurement2
Download software ranking
仙剑奇侠传98硬盘WINXP版
jdk1.6 for windows
Tram sex maniac 2 (H) rar bag1
The cock of the Grosvenor LTD handsome
Unix video tutorial7
少妇苏霞全本
Ashlynn Video5
Unix video tutorial4
尖东毒玫瑰A
Boxer vs Yellow1
归海一刀 published in(发表于) 2014/2/3 6:46:15 Edit(编辑)
最基本的sql语句操作_[SQL Server教程]

最基本的sql语句操作_[SQL Server教程]

最基本的sql语句操作_[SQL Server教程]
  首先,简要介绍基础语句:
  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.