먼저 MSSQL의 경우 다음과 같이 사용을 합니다.
- select top 1 * from table order by newid()
- Select * from table order by rand() limit 0,1
- select * from table sample (1) where rownum = 1
- select * from max_theater sample (1) where rownum = 1
sample안의 숫자는 가져올 레코드의 몇 퍼센트를 가져올것인가입니다.
즉, (1)이라면 전체의 1%에 해당하는 레코드를 가져오며 소수점도 사용가능합니다.
ORDER BY DBMS_RANDOM.RANDOM()