摘要:
(1)最常用的INSERT语句的形式如下:INSERT INTO ()VALUES(,,...n)--从一个表中查出数据导入到另一个表中INSERT INTO ()--SELECT FROM (2)SELECT INTO 语句SELECT INTO --新表本身不存在FROM (3)更新数据UPDATE set column='',...(4)删除数据DELETE FROM --一般有限制条件truncate table -- 将表删除;能够清除自增长列(5)MERGE 语句(***************转载)使用方法: Merge Into 目标表 as T Using 源 阅读全文
摘要:
(1)select name,subject,result from resultInfo(2)select name,sum(result) from resultInfo group by name(3)select name ,sum(result) as 总分 from resultInfo group by name with cubeselect case when grouping(name)=1 then '总计' else name end as 姓名 ,sum(result) as 总分 from resultInfo group by name with 阅读全文
摘要:
--select查询结果为常量select 1 select 'select'--alias 别名的使用select 1 as aa select stuNo as id from stuInfo--列别名select s.stuNO From StuInfo as s --表别名--数据类型的转化 cast convertselect CAST(stuNo as varchar(10)) as NewstuNo from stuInfo select CONVERT(varchar(10),stuNo) as NewStuNo from stuInfo--时间日期的格式化se 阅读全文