易截截图软件、单文件、免安装、纯绿色、仅160KB

sql常用语句

use myoa
select * from
delete from department where departmentid=1
insert Department(DepartmentId,DepartmentName) values(1,'技术部')
update Department set departmentname='信息技术部' where departmentid=1
--删除表
drop table department
--删除数据库
drop database bai
--统计数据库表中记录
select count(*) as 数据库记录 from Department


相关文档:

SQL DELETE from的用法

在某些情况下,我们会需要直接由数据库中去除一些资料。这可以藉由 DELETE from 指令来达成。它的语法是:
DELETE from "表格名"
WHERE {条件}
以下我们用个实例说明。假设我们有以下这个表格:
Store_Information 表格
store_name
Sales
Date
Los Angeles
$1500
Jan-05-1999
San Diego
$250
Jan-0 ......

sql语句 得到 sql server 表中列的类型和说明

通过Sql语句获得 列的类型和说明:
  得到的表头:表名|列名|类型|说明
  1:针对sql server 2000,在sql2000中,使用:sysobjects,syscolumns和sysproperties表
    SELECT o.name as table_name,c.name AS col_name,type_name(c.xtype) AS type_name,isnull(p.value,'') AS col_Pro ......

sql server高级查询


1)  统计各个系的学生信息
select count(Sname) 总人数,Sdept from Student group by Sdept
2)  查询信管系学生的最大年龄和最小年龄
select MAX(Sage) 最大年龄,MIN(Sage) 最小年龄 from Student where
Sdept='信管系'
3)  查询信管系最大年龄和最小年龄的学生的姓名
  select Sname from St ......

如何写有效率的SQL查询


[转载]http://www.cnblogs.com/cn_wpf/,非常感谢Nineteen@newsmth 的分分享。 
写有效率的SQL查询(I)
大型系统的生产环境,一般情况下,我们评价一条查询是否有效率,更多的是关注逻辑IO(至于为什么,回头补一篇)。我们常说,“要建彪悍的索引”、“要写高效的SQL”,其实最终目的就是在相 ......

SQL时间函数

--日期转换参数,值得收藏
select CONVERT(varchar, getdate(), 120 )2004-09-12 11:06:08
select replace(replace(replace(CONVERT(varchar, getdate(), 120 ),'-',''),' ',''),':','')20040912110608
select CONVERT(varchar(12) , getdate(), 111 )2004/09/12
select CONVERT(varchar(12) , getdate(), 112 )20040912 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号