mysqlÖÐfrom dualʲôÒâ˼
from dual ÔÚ mysql ÖÐÓÃÓÚ´Óµ¥ÐÐÐéÄâ±í dual ÖмìË÷Êý¾Ý£¬³£ÓÃÓÚ»ñÈ¡Ä¿½ñÈÕÆÚºÍʱ¼ä¡¢Êý¾Ý¿â°æ±¾£¬»ò×÷ΪÅÌÎÊÖеÄռλ·û»òÖ´ÐÐ ddl Óï¾ä¡£
MySQL ÖÐµÄ FROM DUAL
ÎÊÌ⣺FROM DUAL ÔÚ MySQL ÖÐÊÇʲôÒâ˼£¿
»Ø¸²£º
FROM DUAL ÔÚ MySQL ÖÐÓÃÓÚ´ÓÒ»¸ö°üÀ¨¼òµ¥ÐеÄÐéÄâ±í DUAL ÖмìË÷Êý¾Ý¡£Ëüͨ³£ÓÃÓÚÔÚûÓÐÏÖʵÊý¾Ý±íµÄÇéÐÎÏÂÖ´ÐÐÅÌÎÊ»ò»ñÈ¡ÔªÊý¾ÝÐÅÏ¢¡£
ÏêϸڹÊÍ£º
DUAL ±íÊÇÒ»¸öÌØÊâµÄÐéÄâ±í£¬Ëü²»°üÀ¨ÈκÎÊý¾Ý£¬µ«Ê¼ÖÕ±£´æÓÚÊý¾Ý¿âÖС£Ëü°üÀ¨Ò»ÐУ¬ÆäÁÐÃûΪ DUMMY¡£
ʹÓà FROM DUAL Óï¾ä´Ó DUAL ±íÖмìË÷Êý¾Ýʱ£¬Ëü½«·µ»Ø¸Ã¼òµ¥ÐеÄÖµ£¬¼´ DUMMY¡£¸Ãֵͨ³£ÓÃÓÚ×÷Ϊռλ·û»ò³£Á¿£¬ÒÔ×ÊÖú½á¹¹ÅÌÎÊ¡£
FROM DUAL Óï¾äÓÐÒÔÏÂÓÃ;£º
»ñÈ¡Ä¿½ñÈÕÆÚºÍʱ¼ä£ºÊ¹Óà NOW() º¯Êý£¬ÀýÈç SELECT NOW() FROM DUAL¡£
»ñÈ¡Êý¾Ý¿â°æ±¾£ºÊ¹Óà VERSION() º¯Êý£¬ÀýÈç SELECT VERSION() FROM DUAL¡£
×÷Ϊ×ÓÅÌÎÊÖеÄռλ·û£ºÀýÈ磬Ëü¿ÉÒÔÓÃÓÚ»ñÈ¡¿ÕЧ¹û¼¯ÒÔÅþÁ¬µ½ÁíÒ»¸ö±í£¬ÀýÈç SELECT * FROM table1 WHERE id IN (SELECT DUMMY FROM DUAL)¡£
Ö´ÐÐ DDL Óï¾ä£ºÀýÈ磬Ëü¿ÉÒÔÓÃÓÚ½¨Éè»òɾ³ý±í£¬ÀýÈç CREATE TABLE table1 (id INT) FROM DUAL¡£
Óï·¨£º
SELECT <expression> FROM DUAL;</expression>
µÇ¼ºó¸´ÖÆ
ÆäÖÐ ÊÇÒª·µ»ØµÄÖµ»òº¯Êý¡£
ÒÔÉϾÍÊÇmysqlÖÐfrom dualʲôÒâ˼µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡