we have to declare Primary key in one particular column like id column??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

we have to declare Primary key in one particular column like id column???

if I didn't declare any primary column then sql itself declare one column or not???

14th Feb 2017, 4:14 AM
sugumar
sugumar - avatar
2 Answers
0
I don't think it is compulsory to have a primary key in SQL but is is recommended. Every table should have a unique identification which is provided by primary key. Table rows without unique identification in system is not a good practice.
14th Feb 2017, 5:28 AM
Varun Moghe
Varun Moghe - avatar
0
I'd say it's more than recommended usage of 'primary key' when dealing with database. Sometimes you might get identical results in your database, so better to always use it. It just takes couple of seconds to select it when creating columns, so yeah you should use it.
14th Feb 2017, 8:52 PM
Dev
Dev - avatar