MS-SQL > DBMSº° µ¥ÀÌŸ ·£´ý ¼¿·ºÆ®Çϱâ (Random Row Select) - NEWID()
µî·ÏÀÏ : 2020-01-16 17:58
Á¶È¸¼ö : 52,365
MySQL:
SELECT column FROM table ORDER BY RAND() LIMIT 1
PostgreSQL:
SELECT column FROM table ORDER BY RANDOM() LIMIT 1
Microsoft SQL Server:
SELECT TOP 1 column FROM table ORDER BY NEWID()
IBM DB2:
SELECT column FROM table ORDER BY RAND() FETCH FIRST 1 ROWS ONLY
Oracle:
SELECT column FROM ( SELECT column FROM table ORDER BY dbms_random.value ) WHERE rownum = 1
MS-SQL
µ¥ÀÌÅÍ 10°³¸¦ ·£´ýÇÏ°Ô ºÒ·¯¿Í¼ ƯÁ¤Ä®·³À» ¼öÁ¤ÇÏ°í ½ÍÀ» °æ¿ì, ¾Æ·¡ Äõ¸® ó·³ ÇÏ¸é µË´Ï´Ù.
update [Å×À̺í¸í] set Ä®·³='µ¥ÀÌÅÍ' where board_idx in (select top 10 board_idx from [Å×À̺í¸í] order by NEWID() )
µðºñ ·£´ý󸮽à À¯¿ëÇÏ°Ô »ç¿ëµÉ ¼ö ÀÖ´Â Äõ¸® ÀÔ´Ï´Ù.