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 in Database by Shraddha
54 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 by sampriti
• 1,100 points

Related Questions In Database

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,810 points
124 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 darklord
• 6,190 points
56 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 in Database by Omaiz
• 560 points
43 views
0 votes
1 answer

What are the ways to get the count of records in a table

To count the number of records in ...READ MORE

answered Sep 26, 2018 in Database by darklord
• 6,190 points
96 views
0 votes
1 answer

How to sort the data in sql ?

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

answered May 29 in Database by sampriti
• 1,100 points
38 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,130 points
65 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 darklord
• 6,190 points
3,038 views
0 votes
1 answer

How to do a batch insert in MySQL

You can try out the following query: INSERT ...READ MORE

answered Sep 10, 2018 in Database by darklord
• 6,190 points
443 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 in Database by sampriti
• 1,100 points
75 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 in Database by sampriti
• 1,100 points
70 views