问题描述:

I have a table called students with a column called student_id. This column is currently empty Is there a function that will automatically generate a random ID and insert into the table for each record.

Thanks

网友答案:

I would recommend using UUID() function.

INSERT INTO my_table VALES (UUID(), ...);

Or (in your case):

UPDATE students SET student_id = UUID();
网友答案:

You can try using UUID() to create a unique value like

 .... Values(UUID(), "TestUUID");
相关阅读:
Top