SELECT a.ID,
DATEADD( s, RAND( CONVERT( INT, CAST( NEWID() AS BINARY(16) ), 1)) * 252460800, '20080101' ) AS dt
FROM
(VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11), (12), (13), (14), (15)) AS A (ID)
CROSS JOIN
(VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10),
(11), (12), (13), (14), (15), (16), (17), (18), (19), (20),
(21), (22), (23), (24), (25), (26), (27), (28), (29), (30)) AS B(C)
ORDER BY NEWID()
The expr argument determines the data for which you want Oracle Database to compute a hash value. There are no restrictions on the length of data represented by expr, which commonly resolves to a column name. The expr cannot be a LONG or LOB type. It cannot be a user-defined object type. All other data types are supported for expr.
SELECT t.id, t.country, t.salary
FROM t
INNER JOIN
( SELECT country, max(salary) AS max_salary FROM t GROUP BY country ) tm
ON t.country = tm.country AND t.salary = tm.max_salary