Do I need to add primary key in each and every table

0 votes
I have a big doubt, For each and every table in my database do I need to add primary key?
May 29, 2019 in Database by Shraddha
1,463 views

1 answer to this question.

0 votes

Hi Shraddha,

You have a doubt to add a primary key in your table or not? Or is it mandatory to add the primary key?

See, do you know why we use the primary key?

  • We use primary key to restrict the data repetition so that our memory storage will not be wasted.
  • If You need your table to be joinable on something that time we need primary key
  • If you want your table to be clustered, you need some kind of a primary key.

But in database we can create a table without adding the primary key, but experts always preferred tables with primary key.for these facilities.

I hope this answer will help you out ,

Thank you, 

answered May 29, 2019 by sampriti
• 1,120 points

Related Questions In Database

0 votes
1 answer

Add primary key to existing table

You have to drop constraint and recreate ...READ MORE

answered Sep 12, 2022 in Database by narikkadan
• 63,680 points
555 views
0 votes
1 answer

Can I have multiple primary keys in a single table?

A Table can have a Composite Primary Key which ...READ MORE

answered Oct 25, 2018 in Database by Frankie
• 9,830 points
3,751 views
0 votes
1 answer

What do ‘Record’, ‘Field’ and ‘Table’ mean in terms of a database?

You can refer to the following definitions ...READ MORE

answered Nov 12, 2018 in Database by Sahiti
• 6,370 points
21,956 views
0 votes
1 answer

Query to list number of records in each table in a database

Use the below code to list number of ...READ MORE

answered Oct 11, 2019 in Database by Omaiz
• 560 points
1,415 views
0 votes
1 answer

How to sort the data in sql ?

Hi Akash,  If you want to sort ...READ MORE

answered May 29, 2019 in Database by sampriti
• 1,120 points
1,097 views
0 votes
1 answer

SQL query to find third highest salary in company

The easiest way to work this out ...READ MORE

answered Feb 21, 2022 in Database by Neha
• 9,020 points
51,114 views
0 votes
1 answer

Why is not preferable to use mysql_* functions in PHP?

The reasons are as follows: The MySQL extension: Does ...READ MORE

answered Sep 7, 2018 in Database by DataKing99
• 8,250 points
1,238 views
0 votes
1 answer

Find values in a comma separated string in a MySQL query

You can add commas to the left and ...READ MORE

answered Sep 10, 2018 in Database by Sahiti
• 6,370 points
12,868 views
+1 vote
1 answer

Do I need to mention primary key for each table?

Hi Pritha, First, there is no hard and ...READ MORE

answered Jul 4, 2019 in Database by sampriti
• 1,120 points
924 views
0 votes
1 answer

How will I get all the rows from my table where name starts with 's' and ending with 'I'?

Hi Santanu, I understand your problem, You can try ...READ MORE

answered May 28, 2019 in Database by sampriti
• 1,120 points
2,080 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP