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, 2019 in Database by Pritha
1,025 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, 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,600 points
625 views
0 votes
1 answer

Why do I need to configure the SQL dialect of a data source?

Dialect is defined as "a language's variety." ...READ MORE

answered Sep 18, 2022 in Database by narikkadan
• 63,600 points
1,295 views
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,830 points
1,888 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,131 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,711 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,285 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,923 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, 2019 in Database by sampriti
• 1,120 points
1,498 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 25, 2019 in Database by sampriti
• 1,120 points
2,047 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