数据库sql语句大全
数据库sql语句有哪些呢?下面就让我们一起来了解一下吧:
sql语句有很多,比较基本的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%’
排序: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
当然也还有其他的sql语句,具体介绍如下:
若是备份sql server
1、创建、备份数据的 device,示例代码为:
USE master
EXEC sp_addumpdevice 'disk', 'testBack', 'c:\mssql7backup\MyNwind_1.dat'
2、开始、备份,示例代码为:
BACKUP DATABASE pubs TO testBack
若是创建新表
示例代码为:
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
若是删除新表
示例代码为:
drop table tabname
-
丰田凯美瑞保养灯怎么归零,凯美瑞保养灯复位清零方法
丰田系车型保养灯清除方法一1、启动发动机2、摁住“ODO/TRIP”按键不放直到“OIL LIFE”和公里数一起闪烁再松开。3、如果保养灯还在,请多尝试几遍。丰田系车型保养灯清...
问答查看全文>> -
汽车故障代码D01667怎么解决
故障通常只偶尔出现。注意:如果故障只是偶尔存在 (无重复修理) 并且不存在相应的客户投诉,则不允许更换相关控制单元,而且更换也没有意义,如果有客户投诉有报警提示或者故障现象,则...
问答查看全文>> -
大众迈腾热车熄火打不着火,迈腾打不着火怎么办
大众迈腾热车熄火打不着火主要可能是因为节气门、怠速马达、进气道、进气门和燃烧室积碳过多造成的。因为进气道的积碳、污垢过多,空气通道截面积发生变化,使得控制单元无法精确控制怠速进...
问答查看全文>>
推荐
- 1禁止停车贴纸怎么清除?146
- 2雅诗兰黛粉底液和bb霜哪个好 雅诗兰黛粉底液怎么样150
- 3腹泻怎么办 中医3种方法止泻去痛477
- 4卧室衣架哪个牌子好 卧室衣架十大品牌排行榜274
- 5新凌派满载能爬坡吗314
- 6关于荔枝的文案(有关荔枝的文案大全)218
- 7武汉二手车交易合同范本最新5篇407
- 8下午问候客户的短信330