Do I need to mention primary key for each table?

+1 vote
Hey,

I am bit confused about primary key and constraints in database. Is there any rule that for each table I need to use primary key or foreign key?
Jul 4 in Database by Pritha
49 views

1 answer to this question.

+1 vote

Hi Pritha,

First, there is no hard and fast rule to add constraint in your table But we use constraint in our table to reduce data repetition and redundancy in our table.

And if you want to fetch one particular data that time primary key will help you to get that row only.

I hope, this will help you out

Thank you,

answered Jul 4 by sampriti
• 1,100 points

Related Questions In Database

0 votes
1 answer

Which one is suitable for real time big database- Primary Key or Unique Index?

What is a unique index? A unique index ...READ MORE

answered Oct 12, 2018 in Database by Frankie
• 9,810 points
33 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,810 points
90 views
0 votes
1 answer
0 votes
1 answer

Difference between primary key a composite key

Primary key is that column of the table ...READ MORE

answered Sep 5, 2018 in Database by CodingByHeart77
• 3,680 points
1,468 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
22 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
43 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,140 points
1,952 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,140 points
242 views
0 votes
1 answer

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

Hi Shraddha, You have a doubt to add ...READ MORE

answered May 29 in Database by sampriti
• 1,100 points
39 views
0 votes
1 answer

What is the best way to fetch data from table?

Hey Shraddha, I understand your doubts about fetching ...READ MORE

answered May 24 in Database by sampriti
• 1,100 points
26 views