精妙SQL语句收集 - 我的知识收集 - CSDNBlog
SQL语句先前写的时候,很容易把一些特殊的用法忘记,我特此整理了一下SQL语句操作。
一、基础
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)
说明:删%u966
http://blog.csdn.net/chen8148/archive/2007/08/14/1741991.aspx
他们设置了哪些标签:
- 1 Database DB_MSSQL SQL SQLSERVER SQL基础 SQL语句 SQL语句收 技术收集 技术问题 技术研究 精妙SQL语句收集 精妙SQL语句收集(20070822) 数据库 数据库应用 思考 我的知识收集
谁收藏了这个网址:
使用标签:sql,时间:2007-8-14 16:03:21 | 相关网摘
时间:2007-8-14 16:14:48 | 相关网摘
使用标签:SQL,时间:2007-8-14 22:21:19 | 相关网摘
使用标签:sql,时间:2007-8-14 23:19:44 | 相关网摘
时间:2007-8-15 12:08:15 | 相关网摘
时间:2007-8-15 15:02:12 | 相关网摘
时间:2007-8-15 15:23:20 | 相关网摘
时间:2007-8-15 15:23:36 | 相关网摘
时间:2007-8-15 20:02:46 | 相关网摘
使用标签:sql,时间:2007-8-15 22:11:22 | 相关网摘
datedi
使用标签:数据库,时间:2007-8-16 8:24:06 | 相关网摘
时间:2007-8-16 9:35:40 | 相关网摘
时间:2007-8-16 10:21:44 | 相关网摘
时间:2007-8-16 10:37:50 | 相关网摘
时间:2007-8-16 11:40:46 | 相关网摘
时间:2007-8-16 13:44:41 | 相关网摘
时间:2007-8-16 14:43:18 | 相关网摘
时间:2007-8-16 15:36:43 | 相关网摘
时间:2007-8-16 16:01:04 | 相关网摘
时间:2007-8-16 18:01:59 | 相关网摘
时间:2007-8-16 19:03:36 | 相关网摘
时间:2007-8-16 19:06:23 | 相关网摘
时间:2007-8-16 21:24:09 | 相关网摘
时间:2007-8-17 10:57:57 | 相关网摘
使用标签:SQL,时间:2007-8-17 11:03:15 | 相关网摘
时间:2007-8-17 15:21:17 | 相关网摘
时间:2007-8-17 15:27:34 | 相关网摘
时间:2007-8-17 17:49:50 | 相关网摘
时间:2007-8-17 19:07:14 | 相关网摘
时间:2007-8-17 20:46:54 | 相关网摘
时间:2007-8-17 23:22:54 | 相关网摘
时间:2007-8-18 10:39:20 | 相关网摘
时间:2007-8-18 11:07:54 | 相关网摘
精妙SQL语句收集
时间:2007-8-18 14:32:41 | 相关网摘
使用标签:1,时间:2007-8-18 20:29:49 | 相关网摘
比较有用..!
时间:2007-8-18 21:08:01 | 相关网摘
时间:2007-8-19 9:25:10 | 相关网摘
使用标签:sql,时间:2007-8-19 11:41:12 | 相关网摘
使用标签:sql,时间:2007-8-19 13:38:04 | 相关网摘
使用标签:sql,时间:2007-8-19 15:03:53 | 相关网摘
时间:2007-8-19 19:02:49 | 相关网摘
时间:2007-8-20 9:13:31 | 相关网摘
时间:2007-8-20 11:47:45 | 相关网摘
时间:2007-8-20 12:00:59 | 相关网摘
时间:2007-8-20 12:09:01 | 相关网摘
时间:2007-8-20 12:36:52 | 相关网摘
时间:2007-8-20 15:11:45 | 相关网摘
使用旧
时间:2007-8-20 17:26:53 | 相关网摘
,0,getdate()),6)
使用标签:技术研究,时间:2007-8-21 9:09:13 | 相关网摘
SQL
时间:2007-8-21 9:47:35 | 相关网摘
http://tb.blog.csdn.net/TrackBack.aspx?PostId
时间:2007-8-21 11:26:22 | 相关网摘
时间:2007-8-21 12:08:12 | 相关网摘
收藏
时间:2007-8-21 12:39:49 | 相关网摘
收藏
使用标签:思考,时间:2007-8-21 12:41:28 | 相关网摘
使用标签:SQL,时间:2007-8-21 13:27:42 | 相关网摘
时间:2007-8-21 14:00:53 | 相关网摘
时间:2007-8-21 14:33:07 | 相关网摘
提升
时间:2007-8-21 15:04:21 | 相关网摘
时间:2007-8-21 15:15:51 | 相关网摘
时间:2007-8-21 15:34:04 | 相关网摘
时间:2007-8-21 15:38:32 | 相关网摘
时间:2007-8-21 16:08:20 | 相关网摘
SQL语句先前写的时候,很容易把一些特殊的用法忘记,我特此整理了一下SQL语句操作。
一、基础
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)
说明:删%u966
使用标签:SQL,时间:2007-8-21 16:30:49 | 相关网摘
时间:2007-8-21 19:01:53 | 相关网摘
时间:2007-8-21 19:55:15 | 相关网摘
时间:2007-8-21 20:43:29 | 相关网摘
使用标签:SQL,时间:2007-8-22 0:38:59 | 相关网摘
时间:2007-8-22 9:43:44 | 相关网摘
使用标签:SQL,时间:2007-8-22 10:04:47 | 相关网摘
SQL
时间:2007-8-22 11:48:36 | 相关网摘
NION
时间:2007-8-22 13:27:33 | 相关网摘
时间:2007-8-22 16:42:45 | 相关网摘
时间:2007-8-22 17:11:40 | 相关网摘
时间:2007-8-22 18:03:50 | 相关网摘
evice 'disk', 'testBack', 'c:\mssql7backup\MyNwind_1.dat'
--- 开始 备份
BACKUP DATABASE pubs TO testBack
4、说明:创建新表
create table tabname(col1 type1 [not null] [prim
时间:2007-8-22 23:49:33 | 相关网摘
http://tb.blog.csdn.net/TrackBack.aspx?PostId=1741991
使用标签:sql,时间:2007-8-23 10:31:22 | 相关网摘
到处走走, 见好就收 下拉!!!!
时间:2007-8-23 13:23:18 | 相关网摘
时间:2007-8-23 13:59:17 | 相关网摘
使用标签:数据库,时间:2007-8-23 16:45:50 | 相关网摘
时间:2007-8-23 17:58:01 | 相关网摘
使用标签:技术收集,时间:2007-8-23 18:13:12 | 相关网摘
sql
时间:2007-8-23 21:48:51 | 相关网摘
时间:2007-8-24 15:03:42 | 相关网摘
时间:2007-8-24 15:40:17 | 相关网摘
时间:2007-8-24 18:44:43 | 相关网摘
SQL语句先前写的时候,很容易把一些特殊的用法忘记,我特此整理了一下SQL语句操作。
时间:2007-8-25 2:11:29 | 相关网摘
时间:2007-8-25 6:41:11 | 相关网摘
时间:2007-8-25 9:33:59 | 相关网摘
资
时间:2007-8-26 2:24:58 | 相关网摘
使用标签:SQL,时间:2007-8-27 16:54:33 | 相关网摘
精妙SQL语句收集