I’m using a random generator to generate a six digit number, but I need to check is result number already in table, Primary Key is not the thing what I need, I will write result to other table.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It is all about
primary keyANDforeign key. If you want to add a record with an id, that must exist in another table, it is aforeign key.If you don’t want this you can do the following:
I edited my answer because, the query provided by: @eggyal is faster