scideÔÚsqlÖеÄÒâ˼
scide ÔÚ sql ÖÐÓÃÓÚÑ¡Ôñ°üÀ¨Öظ´Ï²»°üÀ¨ null µÄÁУ¬Ó﷨Ϊ select scide(column_name) from table_name¡£ËüÓë distinct ²î±ð£¬ºóÕßֻѡÔñΨһֵ£¬Óë all ²î±ð£¬ºóÕßÑ¡ÔñËùÓÐÐС£
scide ÔÚ SQL ÖеļÄÒå
scide ÊÇ SQL ÖеÄÒ»¸öÒªº¦×Ö£¬´ú±í “SELECT Columns Including Duplicates and Excluding NULLs”£¨Ñ¡Ôñ°üÀ¨Öظ´Ï²»°üÀ¨ NULL µÄÁУ©¡£
ÓÃ;
scide ÓÃÓÚ´Ó±íÖÐÑ¡ÔñÁУ¬Í¬Ê±±£´æÖظ´ÐÐºÍ NULL Öµ¡£
Óï·¨
SELECT scide(column_name) FROM table_name
µÇ¼ºó¸´ÖÆ
ÆäÖУº
column_name ÊÇҪѡÔñµÄÁС£
table_name ÊÇÒªÅÌÎÊµÄ±í¡£
ʾÀý
ÒÔÏÂÅÌÎʽ«´Ó “sales” ±íÖÐÑ¡Ôñ “product_name” ÁУ¬Í¬Ê±±£´æÖظ´ÐÐºÍ NULL Öµ£º
SELECT scide(product_name) FROM sales
µÇ¼ºó¸´ÖÆ
Óë DISTINCT µÄÇø±ð
DISTINCT Òªº¦×ÖÓÃÓÚ´Ó±íÖÐÑ¡ÔñΨһֵ¡£Ëü½«Ïû³ýÖظ´ÐУ¬µ«±£´æ NULL Öµ¡£
Óë ALL µÄÇø±ð
ALL Òªº¦×ÖÓÃÓÚ´Ó±íÖÐÑ¡ÔñËùÓÐÐУ¬°üÀ¨Öظ´ÐÐºÍ NULL Öµ¡£
ÒÔÉϾÍÊÇscideÔÚsqlÖеÄÒâ˼µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡