SQL*PLUSÃüÁî sql±à³ÌÊÖ²á
Ò»¡¢SQL PLUS
1 ÒýÑÔ
SQLÃüÁî
ÒÔÏÂ17¸öÊÇ×÷ΪÓï¾ä¿ªÍ·µÄ¹Ø¼ü×Ö£º
alter drop revoke
audit grant rollback*
commit* insert select
comment lock update
create noaudit validate
delete rename
ÕâЩÃüÁî±ØÐëÒÔ“;”½áβ
´ø*ÃüÁî¾äβ²»±Ø¼Ó·ÖºÅ£¬²¢ÇÒ²»´æÈëSQL»º´æÇø¡£
SQLÖÐûÓеÄSQL*PLUSÃüÁî
ÕâЩÃüÁî²»´æÈëSQL»º´æÇø
@ define pause
# del quit
$ describe remark
/ disconnect run
accept document save
append edit set
break exit show
btitle get spool
change help sqlplus
clear host start
column input timing
compute list ttitle
connect newpage undefine
copy
-------
2 Êý¾Ý¿â²éѯ
Êý¾Ý×Öµä
TAB Óû§´´½¨µÄËùÓлù±í¡¢ÊÓͼºÍͬÒå´ÊÇåµ¥
DTAB ¹¹³ÉÊý¾Ý×ÖµäµÄËùÓбí
COL Óû§´´½¨µÄ»ù±íµÄËùÓÐÁж¨ÒåµÄÇåµ¥
CATALOG Óû§¿É´æÈ¡µÄËùÓлù±íÇåµ¥
select from tab;
describeÃüÁî ÃèÊö»ù±íµÄ½á¹¹ÐÅÏ¢
describe dept
select
from emp;
select empno,ename,job
from emp;
select from dept
order by deptno desc;
Âß¼ÔËËã·û
= !=»ò<> > >= < <=
in
between value1 and value2
like
%
_
in null
not
no in,is not null
ν´ÊinºÍnot in
ÓÐÄÄЩְԱºÍ·ÖÎöÔ±
select ename,job
from emp
where job in ('clerk','analyst');
select ename,job
from emp
where job not in ('clerk','analyst');
ν´ÊbetweenºÍnot between
ÄÄЩ¹ÍÔ±µÄ¹¤×ÊÔÚ2000ºÍ3000Ö®¼ä
select ename,job,sal from emp
where sal between 2000 and 3000;
select ename,job,sal from emp
where sal not between 2000 and 3000;
ν´Êlike,not like
select ename,deptno from emp
where ename like 'S%';
(ÒÔ×ÖĸS¿ªÍ·)
select ename,deptno from emp
where ename like '%K';
(ÒÔK½áβ)
select ename,deptno from emp
where ename like 'W___';
(ÒÔW¿ªÍ·£¬ºóÃæ½öÓÐÈý¸ö×Öĸ)
select ename,job from emp
where job not like 'sales%';
Ïà¹ØÎĵµ£º
¡¡1. ²é¿´Êý¾Ý¿âµÄ°æ±¾
¡¡¡¡select @@version
¡¡¡¡³£¼ûµÄ¼¸ÖÖSQL SERVER´ò²¹¶¡ºóµÄ°æ±¾ºÅ:
¡¡¡¡8.00.194 Microsoft SQL Server 2000
¡¡¡¡8.00.384 Microsoft SQL Server 2000 SP1
¡¡¡¡8.00.532 Microsoft SQL Server 2000 SP2
¡¡¡¡8.00.760 Microsoft SQL Server 2000 SP3
¡¡¡¡8.00.818 Microsoft SQL ......
ÕýÔÚ¼ÓÔØÊý¾Ý...
¡¡¡¡1.°´ÐÕÊϱʻÅÅÐò: select * from TableName Order By CustomerName Collate Chinese_PRC_Stroke_ci_as
¡¡¡¡2.Êý¾Ý¿â¼ÓÃÜ: select encrypt(’ÔʼÃÜÂë’) select pwdencrypt(’ÔʼÃÜÂë’) select pwdcompare(’ÔʼÃÜÂë’,’¼ÓÃܺóÃÜÂë’) = 1--Ïàͬ£»·ñÔ ......
SQL Server 2005Òý½øÁËÒ»¸öºÜÓмÛÖµµÄеÄTransact-SQLÓïÑÔ×é¼þ£ºÒ»¸öͨÓñí±í´ïʽ£¨Common Table Expression£¬CTE£©£¬ËüÊÇÅÉÉú±íºÍÊÓͼµÄÒ»¸ö±ã½ÝµÄÌæ´ú¡£Í¨¹ýʹÓÃCTE£¬ÎÒÃÇ¿ÉÒÔ´´½¨Ò»¸öÃüÃû½á¹û¼¯À´ÔÚSELECT¡¢INSERT¡¢UPDATEºÍDELETEÓï¾äÖÐÒýÓ㬶øÎÞÐë±£´æ½á¹û¼¯½á¹¹µÄÈκÎÔªÊý¾Ý¡£ÔÚ±¾ÎÄÖУ¬ÎÒ½«²ûÊöÈçºÎÔÚSQL Server 2 ......