数据库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
-
威驰转向灯保险丝在哪里?
威驰转向灯保险丝位于方向盘左下方的保险盒内。转向灯是在机动车辆转向时开启以提示前后左右车辆及行人注意的重要指示灯。转向灯灯管采用氙气灯管,单片机控制电路,左右轮换频闪不间断工作...
问答查看全文>> -
行车记录仪格式化是什么意思
是储存卡内存不足的,要格式话的。行车记录仪我的零度DM900也是的,格式话就好了,最好在机器上格式话,在不行就换卡了,看他可有显示不,要换卡在记录仪上正常的话那就说储存卡有问题...
问答查看全文>>
推荐
- 1福特福克斯节温器怎么看正常?374
- 2智能座舱是什么意思?智能座舱主要包括什么309
- 3奔驰e级进口和国产区别在哪?497
- 4带鱼的食用禁忌497
- 5皇冠气门油封颜色不一样装错了怎么办?392
- 62022十字绣哪个牌子好 十字绣十大品牌排行榜359
- 7东风小康c32发动机灯亮了怎么办?398
- 8祝表妹生日快乐的说说316