sqlÓï¾äÓÅ»¯
SQLÓï¾äµÄÓÅ»¯¾ÍÊǽ«ÐÔÄܽϵ͵ÄSQLÓï¾äת»»´ï³ÉͬÑùÄ¿µÄÐÔÄÜÓÅÒìµÄSQLÓï¾ä
ÏÂÃæÎÒÃÇÒ»ÆðÀ´¿´¿´Ò»Ð©¿ÉÒÔÓÅ»¯SQLµÄ·½·¨£¬Ï£Íû´ó¼Ò¶àÌá³öÒâ¼ûÎÒÃǹ²Í¬Ñ§Ï°»òÕßÊÇ´ó¼ÒÓÐʲôºÃµÄÓÅ»¯·½·¨¿ÉÒÔÌá³öÀ´¹²Ïíһϡ£
µÚÒ»ÖÖÓÅ»¯£¨Ê¹ÓÃÖ¸¶¨ÁдúÌæ”*”£©
ʹÓÓ*”¿ÉÒÔ½µµÍ±àдSQLÓï¾äµÄ¸´ÔӶȣ¬µ«ÊÇÈ´½µµÍÁËSQLÓï¾äÖ´ÐеÄЧÂÊ¡£
ͨ¹ýSQLÓï¾äµÄÖ´Ðйý³ÌÎÒÃÇÀ´Á˽âSQLÓï¾äµÄÖ´ÐÐЧÂÊ¡£µ±Ò»ÌõSQLÓï¾ä´Ó¿Í»§¶Ë·¢Ë͵½·þÎñÆ÷¡£ORACLEÐèÒªÖ´ÐÐÒÔϲ½Ö裺
1. ÔÚ¹²Ïí³ØÖÐËÑË÷SQLÓï¾äÊÇ·ñ´æÔÚ¡£
2. ÑéÖ¤SQLÓï¾äµÄÓï·¨ÊÇ·ñÕýÈ·¡£
3. Ö´ÐÐÊý¾Ý×ÖµäÀ´ÑéÖ¤±íºÍÁеĶ¨Òå¡£
4. »ñÈ¡¶ÔÏóµÄ·ÖÎöËø£¬ÒÔ±ãÔÚÓï¾äµÄ·ÖÎö¹ý³ÌÖжÔÏóµÄ¶¨Òå²»»á±»¸Ä±ä¡£
5. ¼ì²éÓû§ÊÇ·ñ¾ßÓÐÏàÓ¦µÄ²Ù×÷ȨÏÞ¡£
6. È·¶¨Óï¾äµÄ×î¼ÑÖ´Ðмƻ®¡£
7. ½«Óï¾äºÍÖ´Ðз½°¸±£´æµ½¹²ÏíµÄSQLÇø
ͨ¹ýÉÏÃæµÄµÚ3ÌõÎÒÃÇÒѾ¿´³öÀ´ÁË£¬Èç¹ûÎÒÃÇÓÃÁË“*”Ìæ´úÁеĻ°¾Í»áÖ´ÐÐÎÒÃǵĵÚÈý²½£¬Ïà·´Èç¹ûÎÒÃÇÃ÷È·µÄÖ¸³öÁËÁÐORACLE¾Í²»»áÈ¥Ö´ÐеÚÈý¸ö²½Öè¡£
ÏÂÃæ¿ÉÒÔͨ¹ý²âÊÔÀ´¿´¿´£º
Select * from cust;
select cust_id from cust;
ͨ¹ýÉÏÃæÁ½ÌõÓï¾äµÄ¶Ô±ÈÎÒÃÇ¿ÉÒÔÇå³þµÄ¿´³öÁ½ÌõÓï¾äµÄÖ´ÐÐʱ¼äµÄ²î±ð£¬Èç¹ûÊý¾Ý½Ï¶à¸üΪÃ÷ÏÔ¡£
µÚ¶þ£¨Ê¹ÓÃWHERE×Ó¾äÀ´Ìæ´úHAVING£©
ʹÓÃHAVING×Ó¾ä¹ýÂË·Ö×飬Ҳ¾ÍÊÇÔÚ·Ö×éÖ®ºó¹ýÂË£¬ÒòΪÐзÖ×éÐèÒªÒ»¶Îʱ¼ä£¬ËùÒÔÓ¦¸Ã¾¡Á¿Ê¹ÓÃWHERE×Ó¾ä¹ýÂËÐУ¬¼õÉÙ·Ö×éµÄÐÐÊý£¬Ò²¾Í¼õÉÙÁË·Ö×éµÄʱ¼ä£¬´Ó¶øÌá¸ß²éѯЧÂÊ¡£
µÚÈý£¨Ê¹ÓÓ>=”Ìæ´ú“>”|ʹÓÓ<=”Ìæ´ú“<”£©
ÀýÈç“ijÁÐ<=8888”ºÍ“ijÁÐ<8889”¼ìË÷½á¹ûÊÇÒ»ÑùµÄ£¬µ«ÊÇЧÂʲ¢²»ÊÇÒ»ÑùµÄ¡£
ʹÓÓ>=”Ìæ´ú“>”|ʹÓÓ<=”Ìæ´ú“<”
ÉÏÃæÁ½¸öÔËËãµÄÇø±ðÔÚÓÚ£¬Èç¹ûʹÓÓijÁÐ<8889”ÔòORACLE»á¶¨Î»µ½8889£¬È»ºóÔÙÈ¥ÕÒ±È8889СµÄÊý¾Ý£¬Èç¹ûʹÓÓijÁÐ<=8888”£¬ÔòORACLEÖ±½Ó¶¨Î»µ½µÈÓÚ8888µÄÊý¡£ËäÈ»ÕâÖÖÓÅ»¯ÏԵòî±ð²»´ó£¬µ«ÊÇÔÚ²éѯÊý¾ÝÁ¿Ìرð´óµÄʱºò£¬ÓÈÆäÔ
Ïà¹ØÎĵµ£º
¶¨Ò壺 ºÎΪ´¥·¢Æ÷£¿ÔÚSQL ServerÀïÃæÒ²¾ÍÊǶÔijһ¸ö±íµÄÒ»¶¨µÄ²Ù×÷£¬´¥·¢Ä³ÖÖÌõ¼þ£¬´Ó¶øÖ´ÐеÄÒ»¶Î³ÌÐò¡£´¥·¢Æ÷ÊÇÒ»¸öÌØÊâµÄ´æ´¢¹ý³Ì¡£
³£¼ûµÄ´¥·¢Æ÷ÓÐÈýÖÖ£º·Ö±ðÓ¦ÓÃÓÚInsert , Update , Delete ʼþ¡£(SQL Server 2000¶¨ÒåÁËеĴ¥·¢Æ÷£¬Õ ......
¡¾»ã×Ü¡¿SQL CODE --- ¾µä·¾«²Ê
Êý¾Ý²Ù×÷Àà SQLHelper.cs
ÎÞÏÞ¼¶·ÖÀà ´æ´¢¹ý³Ì
°ÙÍò¼¶·ÖÒ³´æ´¢
SQL¾µä¶ÌС´úÂëÊÕ¼¯
ѧÉú±í ¿Î³Ì±í ³É¼¨±í ½Ìʦ±í
50¸ö³£ÓÃsqlÓï¾ä
SQL SERVER
ÓëACCESS¡¢EXCELµÄÊý¾Ýת»»
Óαê
¸ù¾Ý²»Í¬µÄÌõ¼þ²éѯ²»Í¬µÄ±í
INNER JOIN Óï·¨
master.dbo.sp ......
select *
from (
select soft.NETMODEL,
soft.softname,
soft.softid ......
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 Select IntoÓï¾ä
The SELECT INTO Statement
SELECT INTO Óï¾ä
The SELECT INTO statement is most often used to create backup copies of tables or for archiving records.
SELECT INTOÓï¾ä³£ÓÃÀ´¸øÊý¾Ý±í½¨Á¢±¸·Ý»òÊÇÀúÊ·µµ°¸¡£
Syntax
Óï·¨
SELECT column_name(s) INTO newtable [IN externaldatabase] ......