sqlserver£¬ÄľäsqlÓï¾ä¸ü¿ì£¿
±ísinger£º
singerID£¬singerName
1£¬ÁõµÂ»ª
2£¬ÕÅѧÓÑ
3£¬¹ù¸»³Ç
4£¬ÀèÃ÷
±ísong£º
songID£¬songName£¬singerID
1£¬ÍüÇéË®£¬1
2£¬ÖйúÈË£¬1
3£¬ÎDZð£¬2
4£¬¶ÔÄã°®²»Í꣬3
5£¬½ñÒ¹Äã»á²»»áÀ´£¬4
ÎÒÏë²éÕÒÁõµÂ»ªµÄ¸èÇú£¬ÓÐÁ½ÖÖsqlÓï¾ä£º
1.Á½±íÁ¬½Ó
C# code:
select song.songName
from song,singer
where song.singerID = singer.singerID
and singer.singerName = 'ÁõµÂ»ª'
2.ǶÌ×
SQL code:
select songName
from song
where singerID = (select singerID from singer where singerName = 'ÁõµÂ»ª')
ÔÚÊý¾ÝÁ¿ºÜ´óµÄÇé¿öÊÇ£¬ÊÇÁ¬½Ó±í¸ü¿ì»¹ÊÇǶÌ׸ü¿ì£¿
лл£¡
Êý¾ÝÁ¿´ó,Á¬½Ó¿ì
1
¿´Ï¼ƻ®,Èç¹ûÊÇÕâÁ½¾äÓ¦¸Ã²î²»¶à.
µÚÒ»ÖÖ·½·¨Ó¦¸Ã¿ìÒ»µã ǶÌ×ЧÂʲ»¸ß
ѧϰ ÔÀ´Áª²é±È½Ï¿ì°¡
1
µ±È»µÚÒ»ÖÖÁË£¡¶øÇÒд·¨»¹¼òµ¥Ð©
SQL code:
select * from icstockbillentry
--171010Ìõ¼Ç¼£¬ÓÃʱ:45s
---------------
--²âÊÔjoin·½°¸ÓÃʱ
-------------------
declare @d datetime
set @d=getdate()
select b.fnote
from icstockbill a,icstockbillentry b
where a.finterid=b.
Ïà¹ØÎÊ´ð£º
´ó¼ÒºÃ£¬ÇëÎÊÔÚ±íMÖÐÓÐ×ֶΣºa b c d e
ÎÒÏë²é³öÆäÖÐÂú×ãÏÂÃæÈÎÒâÒ»ÏîµÄÊý¾Ý£¬1.×Ö¶Îa µÄÖµ²»ÊÇ ¡®Êé»ò±Ê»ò±¾¡¯ÖÐÈÎÒ»£¬2.aΪÊéµÄʱºò×Ö¶Îb,cÊÇ¿Õ;3.µ±aֵΪ±ÊµÄʱºòdÊÇ¿Õ;4.µ±aΪ±¾µÄʱºòb,d,e¶¼ÊÇ¿Õ;5.È ......
СµÜÊǸöÐÂÊÖ ÏÖÔÚÓиöÎÊÌâÒ»Ö±²»Äܽâ¾ö
ÀýÈç
procedure produce_proc
@p001 nvarchar(8000),
@p002 nvarchar(8000),
@p003 nvarchar(8000),
& ......
´ó¼Ò°ïæ¿´¿´Õâ2¸ösqlÓï¾äÄĸö²éѯµÄËٶȸü¿ìµã¡£Ð»Ð»°ïæ¡£±È½Ï׿±¡£ÔÚ×öÐÔÄܲâÊÔ¡£
select * from
±íA LEFT OUTER JOIN ±íB ON (±íA.id || ' ' =±íB.id) ,±íC , ±íD, ±íE
WhereÆäËûÌõ¼þ
select * ......
select convert(varchar(50),cast(convert(numeric(18,2),1275674000000/100000000)as real))+'ÒÚ'
select cast(convert(numeric(18,2),1275674000000/100000000)as real)
ΪʲôÉÏÒ»¸öÓÃvarcharת»»ºó¾ÍÖ»±£ÁôÁËÒ ......
ÔÚSqlServerÖÐÈçºÎ²é¿´ÀúÊ·ÉÏÖ´ÐеĴ洢¹ý³ÌµÄÐÅÏ¢ÄØ£¬È磺´«Èë²ÎÊý£¬Ö´ÐÐʱ¼äµÈµÈ¡£Èç¹û²»Äܲ鿴ÀúÊ·¼Ç¼£¬ÊÇ·ñ¿ÉÒÔ×Ô¼ºÐ´´¥·¢Æ÷Ö®ÀàµÄ£¬È˹¤¿ØÖÆÄØ£¬ÔÚOracleÀïÃæÓж¯Ì¬ÊÓͼ¿ÉÒÔËæʱ²é¿´ÀúÊ·Ö´ÐеÄsqlÓï¾ä£¬SqlSer ......