×ðÁú¿­Ê±¹ÙÍøµÇ¼

sqlÖÐfrom dualÊÇʲôÒâ˼

ÔÚ sql ÖУ¬from dual Óï¾ä´ÓÒ»¸öÌØÊâÐéÄâ±í dual ÖмìË÷Ò»ÐÐÒ»ÁеÄÊý¾Ý£¬¸Ã±í½ö°üÀ¨Ò»¸öֵΪ x µÄÐÐ ¡£Æä³£¼ûÓ÷¨°üÀ¨£º³õʼ»¯ÐòÁС¢²åÈëĬÈÏÖµºÍ×÷Ϊ×ÓÅÌÎÊÖеÄÐéÄâ±í ¡£

SQL ÖÐ FROM DUAL µÄ¼ÄÒå

ÔÚ SQL ÖУ¬FROM DUAL Óï¾äÓÃÓÚ´ÓÒ»¸ö³ÆΪ DUAL µÄÌØÊâÐéÄâ±íÖмìË÷Ò»ÐÐÊý¾Ý ¡£Õâ¸ö±íÖ»ÓÐÒ»ÐÐÒ»ÁУ¬ÁÐÃûʼÖÕΪ DUMMY£¬²¢ÇÒֵҲʼÖÕΪ X ¡£

ʹÓó¡¾°

ÒÔÏÂÊÇһЩʹÓà FROM DUAL µÄ³£¼û³¡¾°£º

³õʼ»¯ÐòÁУº¿ÉÒÔʹÓà FROM DUAL À´³õʼ»¯ÐòÁУ¬ÀýÈ磺

CREATE SEQUENCE my_sequence START WITH 1 INCREMENT BY 1;
ALTER SEQUENCE my_sequence OWNED BY my_table.my_column;

µÇ¼ºó¸´ÖÆ

²åÈëĬÈÏÖµ£º¿ÉÒÔʹÓà FROM DUAL Ϊ±íÖеÄÁÐÉèÖÃĬÈÏÖµ£¬ÀýÈ磺

ALTER TABLE my_table ADD COLUMN my_column INT DEFAULT (SELECT 1 FROM DUAL);

µÇ¼ºó¸´ÖÆ

×ÓÅÌÎÊ£ºFROM DUAL ¿ÉÒÔÓÃ×÷×ÓÅÌÎÊÖеÄÐéÄâ±í£¬ÀýÈ磺

SELECT * FROM (SELECT 1 FROM DUAL) AS subquery;

µÇ¼ºó¸´ÖÆ

ʾÀý

ÒÔÏÂÊÇÒ»¸öʹÓà FROM DUAL µÄ¼òÆÓʾÀý£º

SELECT 1 FROM DUAL;

µÇ¼ºó¸´ÖÆ

´ËÅÌÎÊ·µ»ØÒ»ÐÐÒ»ÐÐÊý¾Ý£¬¸ÃÐаüÀ¨Ò»¸öÕûÊýÖµ 1 ¡£

×¢ÖØ£º

DUAL ±íÊÇÒ»¸öÖ»¶Á±í£¬²»¿ÉÔÚÆäÖвåÈë¡¢¸üлòɾ³ýÊý¾Ý ¡£

FROM DUAL ½öÓÃÓÚÀû±ã£¬Ëü²»Ö´ÐÐÈκÎÏÖʵ²Ù×÷ ¡£ËüʵÖÊÉÏÖ»ÊÇ·µ»ØÒ»¸ö°üÀ¨Ò»ÐÐÊý¾ÝµÄÐéÄâ±í ¡£

ÒÔÉϾÍÊÇsqlÖÐfrom dualÊÇʲôÒâ˼µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼ ¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý ¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ