How to Order by random on a SQL query

You can use ORDER BY rand(), but it’s a very heavy query as a temporary table is created for it.

A WC_Product_Query or a WP_Query could be a good alternative to WPDB custom query. Both support 'orderby' => 'rand',

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)