Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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
--ÿ¸öÈ˵IJ¿ÃűàºÅ£¬ÐÕÃû£¬Ð½Ë®
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 year" from emp;
--Èç¹ûûÓÐÄÚÈÝ£¬ÔòΪ¿Õ
select comm from


Ïà¹ØÎĵµ£º

ʹÓÃSQLServerÄ£°åÀ´Ð´¹æ·¶µÄSQLÓï¾ä

Èç¹ûÄã¾­³£Óöµ½ÏÂÃæµÄÎÊÌ⣬Äã¾ÍÒª¿¼ÂÇʹÓÃSQL ServerµÄÄ£°åÀ´Ð´¹æ·¶µÄSQLÓï¾äÁË£º
SQL³õѧÕß¡£
¾­³£Íü¼Ç³£ÓõÄDML»òÊÇDDL SQL Óï¾ä¡£
ÔÚ¶àÈË¿ª·¢Î¬»¤µÄSQLÖУ¬Ã¿¸öÈ˶¼ÓÐ×Ô¼ºµÄSQLÏ°¹ß£¬Ã»ÓÐÒ»Ì×ͳһµÄ¹æ·¶¡£
ÔÚSQL Server Management StudioÖУ¬ÒѾ­¸ø´ó¼ÒÌṩÁ˺ܶೣÓõÄÏÖ³ÉSQL¹æ·¶Ä£°å¡£
SQL Server Management ......

Oracle¿ª·¢Ö®SQLÓï¾ä°¸Àý—·ÖÎöº¯ÊýµÄʹÓÃ

´´½¨¹ÍÔ±±í£º
create table emp(deptno number(10),ename varchar2(100),sal number(10,2))£»
²åÈëÊý¾Ý
begin
insert into emp values('10','KING',5000);
insert into emp values('10','CLARK',2450);
insert into emp values('10','MILLER',1300);
insert into emp values('20','SCOTT',3000);
insert into emp v ......

ÖØбàÒëËùÓÐÎÞЧµÄPL/SQLÄ£¿é£¨¶ÔÏó£©

µ±OracleÊý¾Ý¿â´´½¨Íê³Éºó£¬ÏµÍ³½«»á×Ô¶¯ÔËÐÐutlrp.sqlÕâ¸ö½Å±¾Îļþ£¨D:\oracle\product\10.1.0\Db_1\RDBMS\ADMIN£©£¬µ«ÊÇ£¬µ±Í¨¹ý¶¨ÖÆ°²×°ÀàÐ͵ķ½Ê½´´½¨ÁËÊý¾Ý¿âʱ£¬ÏµÍ³Ôò²»»áÔËÐÐutlrp.sqlÕâ¸ö½Å±¾£¬ËùÒÔ£¬½¨ÒéÔÚ´´½¨¡¢¸üлòǨÒÆÒ»¸öÊý¾Ý¿âºó£¬ÔËÐÐÒ»ÏÂutlrp.sqlÕâ¸ö½Å±¾£¬ÒÔÑéÖ¤Êý¾Ý¿â°²×°ÊÇ·ñ³É¹¦£¬ÕâÑù¿ÉÒÔÖØбàÒë ......

Oracle SQL Óï¾ä¶Ôʱ¼ä²Ù×÷µÄ×ܽá

ÔÚSQLÓï¾äÖУ¬³£³£Óûá¶Ôʱ¼ä£¨»òÈÕÆÚ£©½øÐÐһЩ´¦Àí£¬ÏÂÃæÊDZȽÏͨÓõÄһЩÓï¾ä£º
ÑÓ³Ù£º
sysdate+(5/24/60/60)          ÔÚϵͳʱ¼ä»ù´¡ÉÏÑÓ³Ù5Ãë
sysdate+5/24/60               ÔÚϵͳʱ¼ä»ù´ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ