ORACLEºÍSQLÓï·¨Çø±ð¹éÄÉ
ORACLEºÍSQLÓï·¨Çø±ð¹éÄÉ
Êý¾ÝÀàÐͱȽÏ
ÀàÐÍÃû³Æ
Oracle
SQLServer
±È½Ï
×Ö·ûÊý¾ÝÀàÐÍ CHAR CHAR ¶¼Êǹ̶¨³¤¶È×Ö·û×ÊÁϵ«oracleÀïÃæ×î´ó¶ÈΪ2kb£¬SQLServerÀïÃæ×î´ó³¤¶ÈΪ8kb
±ä³¤×Ö·ûÊý¾ÝÀàÐÍ VARCHAR2 VARCHAR OracleÀïÃæ×î´ó³¤¶ÈΪ4kb£¬SQLServerÀïÃæ×î´ó³¤¶ÈΪ8kb
¸ù¾Ý×Ö·û¼¯¶ø¶¨µÄ¹Ì¶¨³¤¶È×Ö·û´® NCHAR NCHAR Ç°Õß×î´ó³¤¶È2kbºóÕß×î´ó³¤¶È4kb
¸ù¾Ý×Ö·û¼¯¶ø¶¨µÄ¿É±ä³¤¶È×Ö·û´® NVARCHAR2 NVARCHAR ¶þÕß×î´ó³¤¶È¶¼Îª4kb
ÈÕÆÚºÍʱ¼äÊý¾ÝÀàÐÍ DATE ÓÐDatetimeºÍSmalldatetimeÁ½ÖÖ ÔÚoracleÀïÃæ¸ñʽΪDMYÔÚSQLSerserÀïÃæ¿ÉÒÔµ÷½Ú£¬Ä¬ÈϵÄΪMDY
Êý×ÖÀàÐÍ NUMBER(P,S) NUMERIC[P(,S)] OracleÀïÃæp´ú±íСÊýµã×óÃæµÄλÊý£¬s´ú±íСÊýµãÓÒÃæµÄλÊý¡£¶øSQLServerÀïÃæp´ú±íСÊýµã×óÓÒÁ½ÃæµÄλÊýÖ®ºÍ£¬s´ú±íСÊýµãÓÒÃæµÄλÊý¡£
Êý×ÖÀàÐÍ DECIMAL(P,S) DECIMAL[P(,S)] OracleÀïÃæp´ú±íСÊýµã×óÃæµÄλÊý£¬s´ú±íСÊýµãÓÒÃæµÄλÊý¡£¶øSQLServerÀïÃæp´ú±íСÊýµã×óÓÒÁ½ÃæµÄλÊýÖ®ºÍ£¬s´ú±íСÊýµãÓÒÃæµÄλÊý¡£
ÕûÊýÀàÐÍ INTEGER INT ͬΪÕûÊýÀàÐÍ£¬´æ´¢´óС¶¼Îª4¸ö×Ö½Ú
¸¡µãÊýÀàÐÍ FLOAT FLOAT
ʵÊýÀàÐÍ REAL REAL
ORACLEÄÚ²¿º¯Êý´óÈ«ÒÔ¼°ÓëSQLSERVERµÄÇø±ð£º
ÏÂÃæÊÇOracleÖ§³ÖµÄ×Ö·ûº¯ÊýºÍËüÃǵÄMicrosoft SQL ServerµÈ¼Ûº¯Êý¡£
º¯Êý Oracle Microsoft SQL¡¡Server
°Ñ×Ö·ûת»»ÎªASCII :ASCII ASCII
×Ö´®Á¬½Ó: CONCAT --------------(expression + expression)
°ÑASCIIת»»Îª×Ö·û CHR, CHAR
·µ»Ø×Ö·û´®ÖеĿªÊ¼×Ö·û£¨×óÆ𣩠INSTR ,---------------CHARINDEX
°Ñ×Ö·ûת»»ÎªÐ¡Ð´ LOWER ---------------------LOWER
°Ñ×Ö·ûת»»Îª´óд UPPER-------------------- UPPER
Ìî³ä×Ö·û´®µÄ×ó±ß LPAD --------------------N/A
Çå³ý¿ªÊ¼µÄ¿Õ°× LTRIM--------------------LTRIM
Çå³ýβ²¿µÄ¿Õ°× RTRIM --------------------RTRIM
×Ö·û´®ÖеÄÆðʼģʽ£¨pattern£© INSTR --------------------PATINDEX
¶à´ÎÖظ´×Ö·û´® RPAD --------------------REPLICATE
×Ö·û´®µÄÓïÒô±íʾ SOUNDEX --------------------SOUNDEX
Öظ´¿Õ¸ñµÄ×Ö´® RPAD --------------------SPACE
´ÓÊý×ÖÊý¾Ýת»»Îª×Ö·ûÊý¾Ý TO_CHAR --------------------STR
×Ó´® SUBSTR --------------------SUBSTRING
Ìæ»»×Ö·û REPLACE --------------------STUFF
½«×Ö´®ÖеÄÿ¸ö´ÊÊ××Öĸ´óд INITCAP --------------------N/A
·Òë×Ö·û´® TRANSLATE ---------------
Ïà¹ØÎĵµ£º
ʹÓÃORDER BY×Ӿ䣬ROWNUMÄÚÖú¯ÊýºÍDBMS_RANDOM°üÖеÄÄÚÖú¯ÊýVALUEÀ´ÊµÏÖ
SQL> select * from
2 (
3 select ename,job
4 from emp
5 order by dbms_random.value()
6 )
7 where rownum<=5;
ENAME JOB
---------- ---------
TURNER SALESMAN
SMITH CLERK
MARTIN SA ......
¡¡¡¡±¾ÎĽéÉÜÁËÔÚOracleÊý¾Ý¿âÖУ¬¶ÔÈÕÆÚ¡¢Ê±¼äµÄ¸÷ÖÖ²Ù×÷£¬°üÀ¨£ºÈÕÆÚʱ¼ä¼ä¸ô²Ù×÷¡¢ÈÕÆÚµ½×Ö·û²Ù×÷¡¢×Ö·ûµ½ÈÕÆÚ²Ù×÷¡¢trunk / ROUNDº¯ÊýµÄʹÓᢺÁÃ뼶µÄÊý¾ÝÀàÐ͵ȡ£
1.ÈÕÆÚʱ¼ä¼ä¸ô²Ù×÷
¡¡¡¡µ±Ç°Ê±¼ä¼õÈ¥7·ÖÖÓµÄʱ¼ä
¡¡¡¡select sysdate,sysdate - interval '7' MINUTE from dual
¡¡¡¡µ±Ç°Ê±¼ä¼õÈ¥7СʱµÄʱ¼ä
¡¡¡ ......
QQ:1156316388 Tel:010-51527259
Ò»¡¢Æô¶¯
Èý¸öÃüÁ
1¡¢sqlplux /nolog
2¡¢connect /as sysdba
3¡¢startup
¶þ¡¢¹Ø±Õ
1¡¢shutdown immediate;
[oracle@zhao ......
Ò».Êý¾Ý¿ØÖÆÓï¾ä (DML) ²¿·Ö
1.Insert (ÍùÊý¾Ý±íÀï²åÈë¼Ç¼µÄÓï¾ä)
Insert INTO ±íÃû(×Ö¶ÎÃû1, ×Ö¶ÎÃû2, ……) VALUES ( Öµ1, Öµ2, ……);
&nb ......