Shortest code for generating serial ID. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Shortest code for generating serial ID.

Assume that you have table (Emp) which consists of (id, name). What is the best code to generate (ID) starting from (1) to insert it for a new record?

14th Jun 2018, 9:06 AM
ADIL GAAFER
ADIL GAAFER - avatar
3 Answers
+ 6
You can achieve such effect by setting auto-increment option for "id" (MySQL) or Identity option (MsSQL). With this option enabled system will automatically assign new id every time a new record is created. I hope I understand your question correctly here. Hth, cmiiw
15th Jun 2018, 6:49 AM
Ipang
+ 5
You're very welcome my friend, glad to help ; )
15th Jun 2018, 1:09 PM
Ipang
+ 1
Thanks a lot dear.. great job
15th Jun 2018, 11:28 AM
ADIL GAAFER
ADIL GAAFER - avatar