sqlÉúÈÕÌáʾ
¸ù¾ÝÉúÈÕµÄxxÔÂxxÈÕ²éÕÒÔÚ$checkDate¼ÆË㣬$beforeÈÕºóÉúÈյĿͻ§£º
$checkDateΪYYYY-MM-DD
WHERE substring(ADDDATE( '$checkDate', $before ),6,10)=substring(DATE_FORMAT(birthday,'%Y-%m-%d'),6,10)
$dates ÌìÄÚÉúÈյĿͻ§Î´¿¼Âǵ½Æ½Äê¡¢ÈòÄ꣺£º
$sql.=" (dayofyear( birthday )-dayofyear( '$checkDate' )
BETWEEN 0 AND $dates
OR dayofyear( ADDDATE( birthday, $dates ) ) - dayofyear( ADDDATE( '$checkDate', $dates ) )
BETWEEN 0 AND $dates)";
Ïà¹ØÎĵµ£º
´Ó¹¦ÄÜÉÏ»®·Ö£¬SQLÓïÑÔ¿ÉÒÔ·ÖΪDDL,DMLºÍDCLÈý´óÀà¡£
1. DDL£¨Data Definition Language£©
Êý¾Ý¶¨ÒåÓïÑÔ£¬ÓÃÓÚ¶¨ÒåºÍ¹ÜÀí SQL Êý¾Ý¿âÖеÄËùÓжÔÏóµÄÓïÑÔ £»
CREATE---´´½¨±í
ALTER---Ð޸ıí
  ......
¶øÕâһƪÖУ¬ÎÒÃǾÍΧÈÆSQLÓÅ»¯À´¿ªÊ¼Õâ´Î½²½â£¬ÎªÊ²Ã´µÚÒ»½²ÒªËµSQLÓÅ»¯£¿ÒòΪÎÒÈÏΪÕâÊdzÌÐòÔ±µÄ»ù±¾¹¦£¬¶øÇÒÒ²ÊÇÎÒÃDZØÐëҪȥÕÆÎյģ¬ËäÈ»ÄãдµÄ SQLÓï¾äÄÜÍê³ÉÏàÓ¦µÄ¹¦ÄÜ£¬µ«ÊÇÄãÊÇ·ñ¿¼ÂǹýÕâЩÓï¾äÅöµ½º£Á¿Êý¾Ý»òÕß±©Á¦·ÃÎÊʱ»á²»»á´øÀ´Ð§ÂʵĴó·ù¶ÈµÄ¼õÂý£¿Ò²ÐíºÜ¶à³ÌÐòÔ±ºÍÎÒÒ»ÑùÔÚÅöµ½ÏµÍ³ÏìÓ¦Ê ......
1.¶àwhere£¬ÉÙhaving
whereÓÃÀ´¹ýÂËÐУ¬havingÓÃÀ´¹ýÂË×é
2.¶àunion all£¬ÉÙunion
unionɾ³ýÁËÖظ´µÄÐУ¬Òò´Ë»¨·ÑÁËһЩʱ¼ä
3.¶àExists£¬ÉÙin
ExistsÖ»¼ì²é´æÔÚÐÔ£¬ÐÔÄܱÈinÇ¿ºÜ¶à£¬ÓÐЩÅóÓѲ»»áÓÃExists£¬¾Í¾Ù¸öÀý×Ó
Àý£¬ÏëÒªµÃµ½Óе绰ºÅÂëµÄÈ˵Ļù±¾ÐÅÏ¢£¬table2ÓÐÈßÓàÐÅÏ¢
select * from table1;--(id,n ......
You can user PL SQL Developer in Ubuntu like in Windows:
1.download PL/SQL Developer for linux;
2.Install JDK berfore the next;
3.install the PL/SQL Developer;
4.goto the $PL/SQL Developer,run sh sqldeverloper.sh;
5.type the $JDK;
6.then the PL/SQL Developer will startup. ......
´ÓA±íËæ»úÈ¡2Ìõ¼Ç¼,ÓÃSELECT TOP 10 * from ywle order by newid()
order by Ò»°ãÊǸù¾Ýijһ×Ö¶ÎÅÅÐò,newid()µÄ·µ»ØÖµÊÇuniqueidentifier ,order by newid()Ëæ»úÑ¡È¡¼Ç¼ÊÇÈçºÎ½øÐеÄ
newid()ÔÚɨÃèÿÌõ¼Ç¼µÄʱºò¶¼Éú³ÉÒ»¸öÖµ, ¶øÉú³ÉµÄÖµÊÇËæ»úµÄ, ûÓдóСд˳Ðò. ËùÒÔ×îÖÕ½á¹ûÔÙ°´Õâ¸öÅÅÐò, ÅÅÐòµÄ½á¹ûµ±È»¾ÍÊÇÎÞÐòµ ......