Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Oracle Sql ÐÔÄÜÓÅ»¯

1£©²»Öª´ó¼ÒÊÇ·ñϲ»¶Ê¹ÓÑNOT IN’ÕâÑùµÄ²Ù×÷£¬Èç¹ûÊÇ£¬ÄǾ¡Á¿Ê¹ÓÃ(NOT) EXISTS Ìæ´ú
2£©ÔÚº£Á¿²éѯʱ¾¡Á¿ÉÙÓøñʽת»»¡£
3£©²éѯº£Á¿Êý¾ÝÊÇ£¬¿ÉÒÔʹÓÃoptimizer['ɔptimaizə] hints£¬ÀýÈç/*+ORDERED */
¾¡Á¿ÉÙÓÃIN²Ù×÷·û£¬»ù±¾ÉÏËùÓеÄIN²Ù×÷·û¶¼¿ÉÒÔÓÃEXISTS´úÌæ¡£
²»ÓÃNOT IN²Ù×÷·û£¬¿ÉÒÔÓÃNOT EXISTS»òÕßÍâÁ¬½Ó+Ìæ´ú¡£
OracleÔÚÖ´ÐÐIN×Ó²éѯʱ£¬Ê×ÏÈÖ´ÐÐ×Ó²éѯ£¬½«²éѯ½á¹û·ÅÈëÁÙʱ±íÔÙÖ´ÐÐÖ÷²éѯ¡£¶øEXISTÔòÊÇÊ×Ïȼì²éÖ÷²éѯ£¬È»ºóÔËÐÐ×Ó²éѯֱµ½ÕÒµ½µÚÒ»¸öÆ¥ÅäÏî¡£NOT EXISTS±ÈNOT INЧÂÊÉԸߡ£µ«¾ßÌåÔÚÑ¡ÔñIN»òEXIST²Ù×÷ʱ£¬Òª¸ù¾ÝÖ÷×Ó±íÊý¾ÝÁ¿´óСÀ´¾ßÌ忼ÂÇ¡£
²»ÓÓ<>”»òÕß“!=”²Ù×÷·û¡£¶Ô²»µÈÓÚ²Ù×÷·ûµÄ´¦Àí»áÔì³ÉÈ«±íɨÃ裬¿ÉÒÔÓÓ<” or “>”´úÌæ¡£
Where×Ó¾äÖгöÏÖIS NULL»òÕßIS NOT NULLʱ£¬Oracle»áֹͣʹÓÃË÷Òý¶øÖ´ÐÐÈ«±íɨÃè¡£¿ÉÒÔ¿¼ÂÇÔÚÉè¼Æ±íʱ£¬¶ÔË÷ÒýÁÐÉèÖÃΪNOT NULL¡£ÕâÑù¾Í¿ÉÒÔÓÃÆäËû²Ù×÷À´È¡´úÅжÏNULLµÄ²Ù×÷¡£
µ±Í¨Åä·û“%”»òÕß“_”×÷Ϊ²éѯ×Ö·û´®µÄµÚÒ»¸ö×Ö·ûʱ£¬Ë÷Òý²»»á±»Ê¹Óá£
¶ÔÓÚÓÐÁ¬½ÓµÄÁГ||”£¬×îºóÒ»¸öÁ¬½ÓÁÐË÷Òý»áÎÞЧ¡£¾¡Á¿±ÜÃâÁ¬½Ó£¬¿ÉÒÔ·Ö¿ªÁ¬½Ó»òÕßʹÓò»×÷ÓÃÔÚÁÐÉϵĺ¯ÊýÌæ´ú¡£
Èç¹ûË÷Òý²»ÊÇ»ùÓÚº¯ÊýµÄ£¬ÄÇôµ±ÔÚWhere×Ó¾äÖжÔË÷ÒýÁÐʹÓú¯Êýʱ£¬Ë÷Òý²»ÔÙÆð×÷Óá£
Where×Ó¾äÖбÜÃâÔÚË÷ÒýÁÐÉÏʹÓüÆË㣬·ñÔò½«µ¼ÖÂË÷ÒýʧЧ¶ø½øÐÐÈ«±íɨÃè¡£
¶ÔÊý¾ÝÀàÐͲ»Í¬µÄÁнøÐбȽÏʱ£¬»áʹË÷ÒýʧЧ¡£
ÓÓ>=”Ìæ´ú“>”¡£
UNION²Ù×÷·û»á¶Ô½á¹û½øÐÐɸѡ£¬Ïû³ýÖظ´£¬Êý¾ÝÁ¿´óµÄÇé¿öÏ¿ÉÄÜ»áÒýÆð´ÅÅÌÅÅÐò¡£Èç¹û²»ÐèҪɾ³ýÖظ´¼Ç¼£¬Ó¦¸ÃʹÓÃUNION ALL¡£
Oracle´Óϵ½ÉÏ´¦ÀíWhere×Ó¾äÖжà¸ö²éѯÌõ¼þ£¬ËùÒÔ±íÁ¬½ÓÓï¾äӦдÔÚÆäËûWhereÌõ¼þÇ°£¬¿ÉÒÔ¹ýÂ˵ô×î´óÊýÁ¿¼Ç¼µÄÌõ¼þ±ØÐëдÔÚWhere×Ó¾äµÄĩβ¡£
Oracle´ÓÓÒµ½×ó´¦Àífrom×Ó¾äÖеıíÃû£¬ËùÒÔÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏ£¬½«¼Ç¼×îÉٵıí·ÅÔÚ×îºó¡££¨Ö»ÔÚ²ÉÓÃRBOÓÅ»¯Ê±ÓÐЧ£¬ÏÂÎÄÏêÊö£©
Order ByÓï¾äÖеķÇË÷ÒýÁлήµÍÐÔÄÜ£¬¿ÉÒÔͨ¹ýÌí¼ÓË÷ÒýµÄ·½Ê½´¦Àí¡£Ñϸñ¿ØÖÆÔÚOrder ByÓï¾äÖÐʹÓñí´ïʽ¡£
²»Í¬ÇøÓò³öÏÖµÄÏàͬµÄSqlÓï¾ä£¬Òª±£Ö¤²éѯ×Ö·ûÍêÈ«Ïàͬ£¬ÒÔÀûÓÃSGA¹²Ïí³Ø£¬·ÀÖ¹ÏàͬµÄSqlÓï¾ä±»¶à´Î·ÖÎö¡£
¶àÀûÓÃÄÚ²¿º¯ÊýÌá¸ßSqlЧÂÊ¡£
µ±ÔÚSqlÓï¾äÖÐÁ¬½Ó¶à¸ö±íʱ£¬Ê¹ÓñíµÄ±ðÃû£¬²


Ïà¹ØÎĵµ£º

SQL Ñ­»·

declare @i int
set @i=1
while @i<30
begin
insert into test (userid) values(@i)
set @i=@i+1
end
---------------
while Ìõ¼þ
begin
Ö´ÐвÙ×÷
set @i=@i+1
end
WHILE
ÉèÖÃÖظ´Ö´ÐÐ SQL Óï¾ä»òÓï¾ä¿éµÄÌõ¼þ¡£Ö»ÒªÖ¸¶¨µÄÌõ¼þΪÕ棬¾ÍÖظ´Ö´ÐÐÓï¾ä¡£¿ÉÒÔʹÓà BREAK ºÍ CONTINUE ¹Ø¼ü×ÖÔÚÑ­»·ÄÚ²¿¿ØÖÆ W ......

JSPÁ¬½ÓSQL SERVER 2008 ÕÒ²»µ½Çý¶¯

ÄÄλ¸ßÊÖÄÜ°ïÎÒ¿´ÏÂΪʲôÅ׳öÕâЩÒì³££¿
´úÂë
<%@ page language="java" import="java.util.*" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="GB2312"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
< ......

sql replace Ìæ»»×Ö¶ÎÖв¿·ÝÖ¸¶¨ÄÚÈÝ

sql replace Ìæ»»×Ö¶ÎÖв¿·ÝÖ¸¶¨ÄÚÈÝ
´´½¨Êý¾Ý¿â½Ì³Ì
create database cnnet;
´´½¨Êý¾Ý±í
CREATE TABLE `cnnet`.`test` (
`id` INT( 4 ) NOT NULL AUTO_INCREMENT ,
`url` VARCHAR( 50 ) NULL ,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM
²å¼¸ÌõÊý¾Ý:
INSERT INTO `test` (`id`, `url`) VALUES
(1, 'www.1aa.cm' ......

SQL Server 2005/2008 °²È«¼à¿Ø£¨´ýÐø£©

-- ²é¿´µ±Ç°dbµÄµÇ½
select * from sys.sql_logins
-- ÉóºËµÇ½Êý¾Ý¿âµÄÓû§
sql server managerment studioÖУ¬ÓÒ¼üµã¿ª·þÎñÆ÷µÄÊôÐÔ£¬ÔÚ°²È«ÐÔҳǩÖУ¬ Ñ¡ÖÐÉóºË“³É¹¦ºÍʧ°ÜµÄµÇ½”£¬ËùÓеǽ¶¼»áÔÚ..MSSQL\Log\ERRORLOGÖмǼһÌõ¼Ç¼¡£
Èç¹û¹´Ñ¡“ÆôÓÃC2ÉóºË¸ú×Ù”£¬½«»áÔÚ..MSSQL\Log\Ŀ¼ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ