Reputation: 11
I want to store data about passengers/guests, who book together, with a common reference number consisting of 6 alphanumeric characters. The primary key in the table would have to be (ref_number, number_of_guest) together (e.g. (ASDFJK; 1) refers to guest #1 within the reservation, (ASDFJK; 2) refers to guest #2 within the reservation).
What I want is to create this reference number with a BEFORE INSERT ON
trigger like SET NEW.ref = randomlyGeneratedString
, but was sad to see that MySQL has only row level statements, therefore I can only add n different reference numbers to all people within the same reservation, but that just makes no sense.
Upvotes: 0
Views: 74
Reputation: 257
I don't think you need a primary key
, as usual primary key
as auto increase,so you can add a field save,then you can do everything.
Upvotes: 1