Database/공통(2)
-
DB별 insert후 자동 sequence Key 값을 가져오는 설정 방법
MySql INSERT INTO CONTENT ( CREATED_DATE, TITLE, CONTENT, CONTENT_TYPE ) VALUES ( now(), #title#, #content#, #contentType# ) ]]> SELECT LAST_INSERT_ID() MSSQL INSERT INTO PRJ_INFO ( ... ) VALUES ( ... ) SELECT SCOPE_IDENTITY() Oracle SELECT message_id_seq.nextval FROM DUALINSERT INTO guestbook_message (message_id, guest_name, password, message) VALUES( #message_id#, #gName#, #pw#, #ms#)
2015.04.23 -
DATABASE별 결과 값 RANDOM 으로 나오게 하기
ORACLE SELECT * FROM TABLE_NAME SAMPLE (3)SELECT * FROM (SELECT * FROM TABLE_NAME ORDER BY DBMS_RANDOM.VALUE)WHERE ROWNUM < 3 MSSQLSELECT TOP 3 * FROM TABLE_NAME ORDER BY NEWID() MYSQLSELECT * FROM TABLE_NAME ORDER BY RAND() LIMIT 0,3
2015.04.23