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
326 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

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,043 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
2,451 views
0 votes
1 answer

Things I need to consider before installing MSSQL on Linux

SQL server on Linux is pretty new ...READ MORE

answered Mar 17, 2019 in Database by Mohor
217 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
319 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 in Database by Neha
• 8,740 points
4,475 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,240 points
363 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,380 points
11,489 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
329 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
997 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP