I have done similar task where I can insert a row into a table if data doesn\'t exists:
WITH user_exists AS ( Select id from users where user