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

¡¾×ª¡¿MySQLÖÐSQLÓÅ»¯ºÍ¼Ü¹¹Éè¼ÆµÄһЩ¼òµ¥Ïë·¨

ÆÕͨMySQLÔËÐУ¬Êý¾ÝÁ¿ºÍ·ÃÎÊÁ¿²»´óµÄ»°£¬ÊÇ×ã¹»¿ìµÄ£¬µ«Êǵ±Êý¾ÝÁ¿ºÍ·ÃÎÊÁ¿¾çÔöµÄʱºò£¬ÄÇô¾Í»áÃ÷ÏÔ·¢ÏÖMySQLºÜÂý£¬ÉõÖÁdownµô£¬ÄÇô¾ÍÒª¿¼ÂÇÓÅ»¯ÎÒÃǵÄMySQLÁË¡£
ÓÅ»¯ÎÞ·ÇÊÇ´ÓÈý¸ö½Ç¶ÈÈëÊÖ£º
µÚÒ»¸öÊÇ´ÓÓ²¼þ£¬Ôö¼ÓÓ²¼þ£¬Ôö¼Ó·þÎñÆ÷
µÚ¶þ¸ö¾ÍÊǶÔÎÒÃǵÄMySQL·þÎñÆ÷½øÐÐÓÅ»¯£¬Ôö¼Ó»º´æ´óС£¬¿ª¶à¶Ë¿Ú£¬¶Áд·Ö¿ª
µÚÈý¸ö¾ÍÊÇÎÒÃǵÄÓ¦ÓÃÓÅ»¯£¬½¨Á¢Ë÷Òý£¬ÓÅ»¯SQL²éѯÓï¾ä£¬½¨Á¢»º´æµÈµÈ
ÎҾͼòµ¥µÄ˵˵SQL²éѯÓï¾äµÄÓÅ»¯¡£ÒòΪÈç¹ûÎÒÃÇWeb·þÎñÆ÷±ÈÊý¾Ý¿â·þÎñÆ÷¶à»òÕßÐÔÄÜÓÅÁ¼µÄ»°£¬ÎÒÃÇÍêÈ«¿ÉÒÔ°ÑÊý¾Ý¿âµÄѹÁ¦×ª¼Þµ½Web·þÎñÆ÷ÉÏ£¬ÒòΪÈç¹ûµ¥Ì¨MySQL£¬»òÕß Master/Slave ¼Ü¹¹µÄÊý¾Ý¿â·þÎñÆ÷¶¼¸ºµ£±È½ÏÖØ£¬ÄÇô¾Í¿ÉÒÔ¿¼ÂÇ°ÑMySQLµÄÔËËã·Åµ½Web·þÎñÆ÷ÉÏÈ¥½øÐС£µ±È»ÁË£¬Èç¹ûÄãWeb·þÎñÆ÷±ÈÊý¾Ý¿â·þÎñÆ÷²î£¬ÄǾͰÑѹÁ¦·ÅÔÚÊý¾Ý¿â·þÎñÆ÷ÉÏ°É£¬ºÇºÇ¡£
Èç¹ûÊÇ°ÑMySQL·þÎñÆ÷µÄѹÁ¦·ÅÔÚWeb·þÎñÆ÷ÉÏ£¬ÄÇôºÜ¶àÔËËã¾ÍÐèÒªÎÒÃǵijÌÐòÈ¥Ö´ÐУ¬±ÈÈçWeb³ÌÐòÖÐÈ«²¿½»¸øPHP½Å±¾È¥´¦ÀíÊý¾Ý¡£µ¥Ì¨MySQL·þÎñÆ÷£¬²éѯ¡¢¸üС¢²åÈ롢ɾ³ý¶¼ÔÚһ̨·þÎñÆ÷ÉϵĻ°£¬·ÃÎÊÁ¿Ò»´ó£¬Äã»áÃ÷ÏÔ·¢ÏÖËø±íÏÖÏ󣬵±¶ÔÒ»¸ö±í½øÐиüÐÂɾ³ý²Ù×÷µÄʱºò£¬¾Í»á¾Ü¾øÆäËû²Ù×÷£¬ÕâÑù¾Í»áµ¼ÖÂËø±í£¬½â¾öÕâ¸öÎÊÌâ×î¼òµ¥Ö±½ÓµÄ°ì·¨¾ÍÊÇÄÃÁ½Ì¨MySQL·þÎñÆ÷£¬Ò»Ì¨¸ºÔð²éѯ£¨select£©²Ù×÷£¬ÁíÍâһ̨¸ºÔð¸ü¸Ä£¨update/delete/insert£©£¬È»ºó½øÐÐͬ²½£¬ÕâÑùÄܹ»±ÜÃâËø±í£¬Èç¹û·þÎñÆ÷¸ü¶à£¬ÄÇô¾Í¸üºÃ´¦ÀíÁË£¬¿ÉÒÔ²ÉÓ÷ֲ¼Ê½Êý¾Ý¿â¼Ü¹¹ºÍÊý¾ÝµÄÉ¢Áд洢£¬ÏÂÃæÎÒÃÇ»á¼òµ¥ËµÒ»Ï¡£
Ò»¡¢SQLµÄÓÅ»¯ºÍ×¢ÒâÊÂÏî
ÏÖÔÚÎÒÃǼÙÉèÎÒÃÇÖ»ÓÐһ̨MySQL·þÎñÆ÷£¬ËùÓеÄselect/update/insert/delete²Ù×÷¶¼ÊÇÔÚÕâÉÏÃæ½øÐеģ¬ÎÒÃÇͬʱÓÐÈý̨Web·þÎñÆ÷£¬Í¨¹ýDNSÂÖѲÀ´·ÃÎÊ£¬ÄÇôÎÒÃÇÈçºÎ½øÐÐÎÒÃÇÓ¦ÓóÌÐòºÍSQLµÄÓÅ»¯¡£
1. WhereÌõ¼þ
ÔÚ²éѯÖУ¬WHEREÌõ¼þÒ²ÊÇÒ»¸ö±È½ÏÖØÒªµÄÒòËØ£¬¾¡Á¿ÉÙ²¢ÇÒÊǺÏÀíµÄwhereÌõ¼þÊǺÜÖØÒªµÄ£¬ÔÚдÿһ¸öwhereÌõ¼þµÄʱºò¶¼Òª×Ðϸ¿¼ÂÇ£¬¾¡Á¿ÔÚ¶à¸öÌõ¼þµÄʱºò£¬°Ñ»áÌáÈ¡¾¡Á¿ÉÙÊý¾ÝÁ¿µÄÌõ¼þ·ÅÔÚÇ°Ã棬ÕâÑù¾Í»á¼õÉÙºóÒ»¸öwhereÌõ¼þµÄ²éѯʱ¼ä¡£
ÓÐʱºòһЩwhereÌõ¼þ»áµ¼ÖÂË÷ÒýÎÞЧ£¬µ±Ê¹ÓÃÁËMysqlº¯ÊýµÄʱºò£¬Ë÷Òý½«ÎÞЧ£¬±ÈÈ磺select * from tbl1 where left(name, 4) = 'hylr'£¬ÄÇôÕâʱºòË÷ÒýÎÞЧ£¬»¹ÓоÍÊÇʹÓÃLIKE½øÐÐËÑË÷Æ¥ÅäµÄʱºò£¬ÕâÑùµÄÓï¾äË÷ÒýÊÇÎÞЧµÄ£ºselect * from tbl1 where name like '%xxx%'£¬µ«ÊÇÕâÑùË÷ÒýÊÇÓÐЧµÄ£ºselect * from tbl1 where name like 'xxx%'£¬ËùÒÔ½÷É÷µÄдÄã


Ïà¹ØÎĵµ£º

sql Êý¾Ý¿âÖв»Í¬Êý¾Ý¿âÖÐÁ½±í´´½¨ÊÓͼ

 CREATE VIEW MYVIEW
AS
   SELECT * from bjxxdiweb_database2007.dbo.bm_tongji
    UNION ALL
SELECT * from aa.DBO.chen
select * into aa..chen from bjxxdiweb_database2007.dbo.bm_tongji where 1=2
˵Ã÷£ºÊý¾Ý¿âAµÄ±íµÄ×Ö¶ÎÃû±ØÐëºÍÊý¾Ý¿âBµÄ±íµÄ×Ö¶ÎÃûÏàͬ£¬°üÀ¨Êý¾ÝÀàÐ͵ȡ£ ......

SQLÓï¾äPART9

Group functions
SELECT [column,] group_function(column) ... from table [WHERE condition] [GROUP BY group_by_expression] [ORDER BY column];
e.g.:
SELECT department_id, job_id, SUM(salary), COUNT(employee_id) from employees GROUP BY department_id, job_id ;
SELECT [column,] group_function(column).. ......

SQLÓï¾äPART11


1. My test: (create and grant the sysdba to a new user by SQL*Plus)
CREATE USER FJTEST1 IDENTIFIED BY JEANJEANFANG;
GRANT SYSDBA TO FJTEST;
REVOKE SYSDBA from FJTEST;
CONNECT FJTEST1/JEANJEANFANG AS SYSDBA;
2. Using ORAPWD in windows:
C:\» ORAPWD;
(show help information)
3. to see th ......

SQLÖÐJOINµÄʹÓÃ


(×¢:outerµÄÒâ˼¾ÍÊÇ"ûÓйØÁªÉϵÄÐÐ"¡£)
1.cross join È«ÍâÁ¬½Ó(µÑ¿¨¶û³Ë»ý)
SELECT A.*, B.* from A FULL OUTER JOIN B ON A.ID = B.ID
2.inner join ÄÚÁ¬½Ó(Ôڵѿ¨¶û³Ë»ýµÄ½á¹û¼¯ÖÐÈ¥µô²»·ûºÏÁ¬½ÓÌõ¼þµÄÐÐ)
SELECT A.* from A INNER JOIN B ON A.ID=B.ID
3.left outer join ×óÍâÁ¬½Ó(ÔÚinner joinµÄ½á¹ ......

[SQL Server]ÑÓ³ÙÖ´ÐÐ


WAITFOR
Ö¸¶¨´¥·¢Óï¾ä¿é¡¢´æ´¢¹ý³Ì»òÊÂÎñÖ´ÐеÄʱ¼ä¡¢Ê±¼ä¼ä¸ô»òʼþ¡£
Óï·¨
WAITFOR { DELAY 'time' | TIME
'time' }
²ÎÊý
DELAY
ָʾ Microsoft® SQL Server™ Ò»Ö±µÈµ½Ö¸¶¨µÄʱ¼ä¹ýÈ¥£¬×¿É´ï 24 Сʱ¡£
'time'
ÒªµÈ´ýµÄʱ¼ä¡£¿ÉÒÔ°´ datetime Êý¾Ý¿É½ÓÊܵĸñʽָ¶¨
time£¬Ò²¿ÉÒÔÓþֲ¿±äÁ¿Ö¸¶ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ