SQLÓÅ»¯( ÒýÓà )
SQLÓÅ»¯²éѯ
ÊÕ²Ø
Êý¾Ý¿âµÄ²éѯÓÅ»¯¼¼Êõ
Êý¾Ý¿âϵͳÊǹÜÀíÐÅϢϵͳµÄºËÐÄ£¬»ùÓÚÊý¾Ý¿âµÄÁª»úÊÂÎñ´¦Àí£¨OLTP£©ÒÔ¼°Áª»ú·ÖÎö´¦Àí(OLAP)ÊÇÒøÐС¢ÆóÒµ¡¢Õþ¸®µÈ²¿ÃÅ×îΪÖØÒªµÄ¼ÆËã»úÓ¦
ÓÃÖ®Ò»¡£´Ó´ó¶àÊýϵͳµÄÓ¦ÓÃʵÀýÀ´¿´£¬²éѯ²Ù×÷ÔÚ¸÷ÖÖÊý¾Ý¿â²Ù×÷ÖÐËùÕ¼¾ÝµÄ±ÈÖØ×î´ó£¬¶ø²éѯ²Ù×÷Ëù»ùÓÚµÄSELECTÓï¾äÔÚSQLÓï¾äÖÐÓÖÊÇ´ú¼Û×î´óµÄÓï
¾ä¡£¾ÙÀýÀ´Ëµ£¬Èç¹ûÊý¾ÝµÄÁ¿»ýÀÛµ½Ò»¶¨µÄ³Ì¶È£¬±ÈÈçÒ»¸öÒøÐеÄÕË»§Êý¾Ý¿â±íÐÅÏ¢»ýÀÛµ½ÉÏ°ÙÍòÉõÖÁÉÏǧÍòÌõ¼Ç¼£¬È«±íɨÃèÒ»´ÎÍùÍùÐèÒªÊýÊ®·ÖÖÓ£¬ÉõÖÁÊýС
ʱ¡£Èç¹û²ÉÓñÈÈ«±íɨÃè¸üºÃµÄ²éѯ²ßÂÔ£¬ÍùÍù¿ÉÒÔʹ²éѯʱ¼ä½µÎª¼¸·ÖÖÓ£¬Óɴ˿ɼû²éѯÓÅ»¯¼¼ÊõµÄÖØÒªÐÔ¡£
±ÊÕßÔÚÓ¦ÓÃÏîÄ¿µÄʵʩÖз¢ÏÖ£¬Ðí¶à³ÌÐò
Ô±ÔÚÀûÓÃһЩǰ¶ËÊý¾Ý¿â¿ª·¢¹¤¾ß£¨ÈçPowerBuilder¡¢DelphiµÈ£©¿ª·¢Êý¾Ý¿âÓ¦ÓóÌÐòʱ£¬Ö»×¢ÖØÓû§½çÃæµÄ»ªÀö£¬²¢²»ÖØÊÓ²éѯÓï¾äµÄЧÂÊÎÊ
Ì⣬µ¼ÖÂËù¿ª·¢³öÀ´µÄÓ¦ÓÃϵͳЧÂʵÍÏ£¬×ÊÔ´ÀË·ÑÑÏÖØ¡£Òò´Ë£¬ÈçºÎÉè¼Æ¸ßЧºÏÀíµÄ²éѯÓï¾ä¾ÍÏԵ÷dz£ÖØÒª¡£±¾ÎÄÒÔÓ¦ÓÃʵÀýΪ»ù´¡£¬½áºÏÊý¾Ý¿âÀíÂÛ£¬½éÉܲé
ѯÓÅ»¯¼¼ÊõÔÚÏÖʵϵͳÖеÄÔËÓá£
·ÖÎöÎÊÌâ
Ðí¶à³ÌÐòÔ±ÈÏΪ²éѯÓÅ»¯ÊÇDBMS£¨Êý¾Ý¿â¹ÜÀíϵͳ£©µÄÈÎÎñ£¬Óë³ÌÐòÔ±Ëù±àдµÄSQLÓï¾ä¹Ø
ϵ²»´ó£¬ÕâÊÇ´íÎóµÄ¡£Ò»¸öºÃµÄ²éѯ¼Æ»®ÍùÍù¿ÉÒÔʹ³ÌÐòÐÔÄÜÌá¸ßÊýÊ®±¶¡£²éѯ¼Æ»®ÊÇÓû§ËùÌá½»µÄSQLÓï¾äµÄ¼¯ºÏ£¬²éѯ¹æ»®ÊǾ¹ýÓÅ»¯´¦ÀíÖ®ºóËù²úÉúµÄÓï¾ä
¼¯ºÏ¡£DBMS´¦Àí²éѯ¼Æ»®µÄ¹ý³ÌÊÇÕâÑùµÄ£ºÔÚ×öÍê²éѯÓï¾äµÄ´Ê·¨¡¢Óï·¨¼ì²éÖ®ºó£¬½«Óï¾äÌá½»¸øDBMSµÄ²éѯÓÅ»¯Æ÷£¬ÓÅ»¯Æ÷×öÍê´úÊýÓÅ»¯ºÍ´æȡ·¾¶µÄÓÅ
»¯Ö®ºó£¬ÓÉÔ¤±àÒëÄ£¿é¶ÔÓï¾ä½øÐд¦Àí²¢Éú³É²éѯ¹æ»®£¬È»ºóÔÚºÏÊʵÄʱ¼äÌá½»¸øϵͳ´¦ÀíÖ´ÐУ¬×îºó½«Ö´Ðнá¹û·µ»Ø¸øÓû§¡£ÔÚʵ¼ÊµÄÊý¾Ý¿â²úÆ·(Èç
Oracle¡¢SybaseµÈ)µÄ¸ß°æ±¾Öж¼ÊDzÉÓûùÓÚ´ú¼ÛµÄÓÅ»¯·½·¨£¬ÕâÖÖÓÅ»¯Äܸù¾Ý´Óϵͳ×Öµä±íËùµÃµ½µÄÐÅÏ¢À´¹À¼Æ²»Í¬µÄ²éѯ¹æ»®µÄ´ú¼Û£¬È»ºóÑ¡ÔñÒ»
¸ö½ÏÓŵĹ滮¡£ËäÈ»ÏÖÔÚµÄÊý¾Ý¿â²úÆ·ÔÚ²éѯÓÅ»¯·½ÃæÒѾ×öµÃÔ½À´Ô½ºÃ£¬µ«ÓÉÓû§Ìá½»µÄSQLÓï¾äÊÇϵͳÓÅ»¯µÄ»ù´¡£¬ºÜÄÑÉèÏëÒ»¸öÔ±¾Ôã¸âµÄ²éѯ¼Æ»®¾¹ýϵ
ͳµÄÓÅ»¯Ö®ºó»á±äµÃ¸ßЧ£¬Òò´ËÓû§ËùдÓï¾äµÄÓÅÁÓÖÁ¹ØÖØÒª¡£ÏµÍ³Ëù×ö²éѯÓÅ»¯ÎÒÃÇÔݲ»ÌÖÂÛ£¬ÏÂÃæÖصã˵Ã÷¸ÄÉÆÓû§²éѯ¼Æ»®µÄ½â¾ö·½°¸¡£
½â¾öÎÊÌâ
ÏÂÃæÒÔ¹ØϵÊý¾Ý¿âϵͳInformixΪÀý£¬½éÉܸÄÉÆÓû§²éѯ¼Æ»®µÄ·½·¨¡
Ïà¹ØÎĵµ£º
¹«¸æ£º±¾²©¿ÍΪ΢ÈíÔƼÆËãÖÐÎIJ©¿ÍµÄ¾µÏñ²©¿Í£¬²¢²»±£Ö¤Á´½Ó¿ÉÓÃÐÔ£¬ÎªÁ˱£Ö¤ÔĶÁÌåÑ飬Çë·ÃÎÊhttp://blogs.msdn.com/azchina¡£
SQL Azure vs. SQL Server
¸ÅÒª
SQL Azure Database ÊÇÒ»¸öÀ´×Ô΢ÈíµÄ£¬»ùÓÚÔƵĹØϵÐÍÊý¾Ý¿â·þÎñ¡£SQL Azure Ìṩ¹ØϵÐÍÊý¾Ý¿â¹¦ÄÜÀ´×÷Ϊ¹«Ó÷þÎñ¡£»ùÓÚÔƵÄÊý¾Ý¿â½â¾ö·½°¸ ......
Ò»¡¢»ù´¡
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
CREATE DATABASE database-name
2¡¢ËµÃ÷£ºÉ¾³ýÊý¾Ý¿â
drop database dbname
3¡¢ËµÃ÷£º±¸·Ýsql server
--- ´´½¨ ±¸·ÝÊý¾ÝµÄ device
USE master
EXEC sp_addumpdevice 'disk', 'testBack', 'c:\mssql7backup\MyNwind_1.dat'
--- ¿ªÊ¼ ±¸·Ý
BACKUP DATABASE pubs TO testBack
4¡¢Ëµ ......
¡¾»ã×Ü¡¿SQL CODE --- ¾µä·¾«²Ê
Êý¾Ý²Ù×÷Àà SQLHelper.cs
ÎÞÏÞ¼¶·ÖÀà ´æ´¢¹ý³Ì
°ÙÍò¼¶·ÖÒ³´æ´¢
SQL¾µä¶ÌС´úÂëÊÕ¼¯
ѧÉú±í ¿Î³Ì±í ³É¼¨±í ½Ìʦ±í 50¸ö³£ÓÃsqlÓï¾ä
SQL SERVER ÓëACCESS¡¢EXCELµÄÊý¾Ýת»»
Óαê
¸ù¾Ý²»Í¬µÄÌõ¼þ²éѯ²»Í¬µÄ±í
INNER JOIN Óï·¨
master.dbo.spt_val ......
declare @p int
declare @p1 int
declare @count int
set @p=0
set @p1=10
set @count=2
if(@count<>0 or @count<>1)
set @p=@p1*@count-10
SELECT [t1].[userid], [t1].[username], [t1].[userorder]
from (
SELECT ROW_NUMBER() OVER (ORDER BY [t0].[userorder]) AS [ROW_NU ......
DATENAME([Year],
dbo.reservation.begintime) + N'Äê' + CAST(DATEPART([Month],
dbo.reservation.begintime) AS varchar) + N'ÔÂ' + DATENAME([Day],
dbo.reservation.begintime) + N'ÈÕ' + DATENAME([Hour], dbo.r ......