Linked Questions

24 votes
8 answers
41k views

Possible Duplicate: What’s wrong with foreign keys? I use MS Sql Server with a large database about 4 GB data. I search around the web why I should use foreign keys. by now I only indexed the ...
user avatar
3 votes
0 answers
4k views

I always create my tables thinking about how they will relate and then put then to work with no dependencies. FK declarations sometimes make tables harder to alter when there is data already, so I don'...
NaN's user avatar
  • 9,234
2 votes
1 answer
1k views

I'm confused about something, time and again i've seen developers including team leaders tell me that using foreign key constraints on their DB is bad practice, that it adds "logic to the database" ...
JonnySerra's user avatar
  • 1,094
138 votes
24 answers
53k views

Foreign keys help the programmer to manipulate data. If a programmer is doing this already, then do we need the concept of foreign keys? What are other uses for foreign keys? What am I missing?
Niyaz's user avatar
  • 55k
8 votes
6 answers
6k views

It is causing so much trouble in terms of development just by letting database enforcing foreign key. Especially during unit test I can’t drop table due to foreign key constrains, I need to create ...
Jeff's user avatar
  • 13.2k
26 votes
4 answers
26k views

I have user and photo documents in Mongodb. Each photo belongs to user and a photo maybe shared among users. Lets say user1 has p1,p2,p3 photos and user2 has p3,p4,p5 photos. If I delete user1 (...
ace's user avatar
  • 12.1k
6 votes
7 answers
5k views

I read somewhere saying that every table should have a primary key to fulfill 1NF. I have a tbl_friendship table. There are 2 fields in the table : Owner and Friend. Fields of Owner and Friends are ...
zac1987's user avatar
  • 2,787
4 votes
3 answers
2k views

My question specifically about sql-server, but probably can be answered by anyone with any database background If I want table A to have a 1:1 relationship with table B on a certain column, should I ...
Alex Gordon's user avatar
  • 61.5k
5 votes
1 answer
2k views

This is my first post here and I've tried to do my homework. I need to have a better way to develop Data Warehouse databases for Postgres than using Power*Architect. Here is the complete sad history:...
Fábio de Salles's user avatar
5 votes
1 answer
3k views

I've mostly used MyISAM tables before, which don't support foreign keys. Looking on stack overflow I didn't find a nice, concise explanation of what a foreign key is actually doing. I'm mostly ...
John Zumbrum's user avatar
  • 2,856
8 votes
2 answers
733 views

One of the disadvantages people point to with using foreign keys in a relational database is the overhead of making sure the parent table exists before doing any insert operation. (Example). As your ...
carlbenson's user avatar
  • 3,217
4 votes
1 answer
788 views

I have two database tables which are logically related through a CharField. For example, a survey response which asks for a phone number, and a person which has a phone number: class SurveyResponse(...
David Wolever's user avatar
-1 votes
3 answers
717 views

IN my mysql database i have two table review and products mysql> desc review; +---------------+--------------+------+-----+-------------------+----------------+ | Field | Type | ...
Karthiga's user avatar
  • 907
0 votes
1 answer
1k views

I've got following situation: I want to connect multiple records from one table with some kind of relation. Record could have no connection to other, or could have multiple of them (1 or more). There ...
mdziob's user avatar
  • 1,176

15 30 50 per page