I have 2 databases – one with customers’ data and the second one with discount codes. I would like to assign code to each customer. The code can be assigned only once, so I would like to mark the code as ‘used’ once it is assigned. The codes should be assigned only to those customers that don’t have a code assigned.
|CUSTOMER ID||CUSTOMER CODE|
Could you please help me write SQL query for this, using MySQL 8.0 syntax?