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

sql语句基础

--------------------------------------------------------
--sql structured query language
--DML--Data Manipulation Language--数据操作语言
query information (SELECT),
add new rows (INSERT),
modify existing rows (UPDATE),
delete existing rows (DELETE),
perform a conditional update or insert operation (MERGE),
see an execution plan of SQL (EXPLAIN PLAN),
and lock a table to restrict access (LOCK TABLE).
--DDL--Data Definition Language--数据定义语言
create, modify,drop, or rename objects (CREATE,ALTER,DROP,RENAME),
remove all rows from a database object without dropping the structure (TRUNCATE),
manage access privileges (GRANT,REVOKE),
audit database use (AUDIT,NOAUDIT)
and add a description about an object to the dictionary (COMMENT).
--Transaction Control事务控制语句
save the changes(COMMIT)
or discard the changes (ROLLBACK) made by DML statements.
Also included in the transaction-control statements are statements to set a point or marker in the transaction for possible rollback (SAVEPOINT)
and to define the properties for the transaction (SET TRANSACTION).
Used to manage the properties of the database.
There isonly one statement in this category (ALTER SYSTEM).
--DCL--Data Control Language--与开发关系不是很密切,用于权限的分配与回收
grant,revoke,data control
--Session Control
control the session properties (ALTER SESSION)
and to enable/disable roles (SET ROLE).
--System Control
--------------------------------------------------------
select的用法
--每个员工的所有信息
select * from emp
--每个人的部门编号,姓名,薪水
select deptno,ename,sal from emp;
--每个人的年薪
select ename,sal*12 from emp;
--计算2*3的值
select 2*3 from emp;
--计算2*3的值(dual)
select 2*3 from dual;
select * from dual;
--得到当前时间
select sysdate from dual
--可以给列起别名,比如求每个人的年薪
select ename,sal*12  salperyear from emp;
--如果别名中有空格,需要用双引号
select ename,sal*12  "sal per y


相关文档:

SQL2005和(Excel |access)之间的数据导入导出


Sql代码
--采用SQL语句实现sql2005和Excel 数据之间的数据导入导出,在网上找来一--下,实现方法是这样的:    
  
  
--Excel---->SQL2005  导入:    
  
  
select * into useinfo from O ......

将access导入SQL server

一、SQL SERVER 和ACCESS的数据导入导出
常规的数据导入导出:
使用DTS向导迁移你的Access数据到SQL Server,你可以使用这些步骤:
  ○1在SQL SERVER企业管理器中的Tools(工具)菜单上,选择Data Transformation
  ○2Services(数据转换服务),然后选择  czdImport Dat ......

SQL JOIN 的用法

对于SQL我也学习了,但是真正用到的时候才知道很多东西还不太理解,在网上看了一下,这篇文章中讲的很好,所以拿来和大家分享一下:
SQL JOIN 的用法
关于sql语句中的连接(join)关键字,是较为常用而又不太容易理解的关键字,下面这个例子给出了一个简单的解释 --建表table1,table2:
create table table1(id int,n ......

sql server 函数大全

一、字符转换函数
1、ASCII()
返回字符表达式最左端字符的ASCII 码值。在ASCII()函数中,纯数字的字符串可不用‘’括起来,但含其它字符的字符串必须用‘’括起来使用,否则会出错。
2、CHAR()
将ASCII 码转换为字符。如果没有输入0 ~ 255 之间的ASCII 码值,CHAR() 返回NULL 。
3、LOWER()和 ......

SQL中delete+insert 和update哪个快

首先说,顺序是insert为1,其次delete再者update
因为delete和update要涉及到全表扫描, update是最慢的,如果数据很多的时候最好使用delete+insert,而非update.即使表有索引,update也是最慢的!
谁再讲讲呗 我也是网上看到的这样说 晚上回家测测看 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号