[Tutorial] [MySQL] Table structure and foreign keys
#22

Quote:
Originally Posted by DarrenReeder
Посмотреть сообщение
I know the tutorial is on foreign keys, but the type of relationship is important with this
If you follow the normalization forms, separation of data into different tables is is automatically forced because there really is no other way of doing it.

Let's say you have a "users" and a "items" table. The logical reasoning is, "a user HAS items", or more importantly "1 user has many items". Or if you want to be absolutely correct, and this is very important while designing a database, "1 OR 0 users CAN HAVE 0 or more items". When you transorm this into a ERD and later into a logical and normalized database you'll automatically end up with a 1-to-many table. As in, 1 "user" can have many "items". It's pure logic, you end up with a certain relation type just because there is not other way of doing it.

Asking which relation you should use is not a fair question. Instead, ask yourself how your data should be organized and what relation they ave to each other.

Database Design is for most people here a quite advanced topic, but I'm glad it's being brought up because if you work with a relational database there really is nothing more important.
Reply


Messages In This Thread
[MySQL] Table structure and foreign keys - by Vince - 04.03.2013, 17:19
Re: [MySQL] Table structure and foreign keys - by Misiur - 04.03.2013, 17:35
Re: [MySQL] Table structure and foreign keys - by Kyle - 04.03.2013, 18:00
Re: [MySQL] Table structure and foreign keys - by Scenario - 04.03.2013, 19:26
Re: [MySQL] Table structure and foreign keys - by nGen.SoNNy - 05.03.2013, 19:00
Re: [MySQL] Table structure and foreign keys - by Stylock - 06.03.2013, 12:48
Re: [MySQL] Table structure and foreign keys - by Sinner - 06.03.2013, 13:05
Re: [MySQL] Table structure and foreign keys - by Yves - 06.03.2013, 13:08
Re: [MySQL] Table structure and foreign keys - by Bluec0de - 06.03.2013, 16:31
Re: [MySQL] Table structure and foreign keys - by Stylock - 06.03.2013, 16:32
Re: [MySQL] Table structure and foreign keys - by Luis- - 09.03.2013, 12:56
Re: [MySQL] Table structure and foreign keys - by AndreT - 09.03.2013, 15:16
Re: [MySQL] Table structure and foreign keys - by Kyle - 20.03.2013, 08:27
Re: [MySQL] Table structure and foreign keys - by Michael@Belgium - 20.03.2013, 09:11
Re: [MySQL] Table structure and foreign keys - by Kar - 12.04.2013, 02:51
Re: [MySQL] Table structure and foreign keys - by Vince - 12.04.2013, 05:36
Re: [MySQL] Table structure and foreign keys - by MP2 - 12.04.2013, 06:22
Re: [MySQL] Table structure and foreign keys - by Jay_ - 14.04.2013, 12:45
Re: [MySQL] Table structure and foreign keys - by dusk - 24.07.2013, 15:55
Re: [MySQL] Table structure and foreign keys - by Sinner - 24.07.2013, 21:31
Re: [MySQL] Table structure and foreign keys - by DarrenReeder - 24.07.2013, 23:20
Re: [MySQL] Table structure and foreign keys - by Sinner - 25.07.2013, 10:04
AW: [MySQL] Table structure and foreign keys - by Mellnik - 15.04.2014, 15:42
Re: [MySQL] Table structure and foreign keys - by gotwarzone - 19.04.2014, 10:09
Re: [MySQL] Table structure and foreign keys - by Vince - 26.08.2015, 10:47
Re: [MySQL] Table structure and foreign keys - by Evocator - 19.10.2015, 17:27
Re: [MySQL] Table structure and foreign keys - by nGen.SoNNy - 22.10.2015, 08:34
Re: [MySQL] Table structure and foreign keys - by knuckleduster5 - 10.12.2016, 09:46
Respuesta: [MySQL] Table structure and foreign keys - by adri1 - 10.06.2017, 20:24
Re: [MySQL] Table structure and foreign keys - by Vince - 10.06.2017, 22:02
Re: [MySQL] Table structure and foreign keys - by Gammix - 10.06.2017, 22:10
Re: [MySQL] Table structure and foreign keys - by Tass007 - 16.07.2017, 11:14
Re: [MySQL] Table structure and foreign keys - by Tass007 - 18.07.2017, 21:49
Re: [MySQL] Table structure and foreign keys - by Tass007 - 22.07.2017, 03:48
Re: [MySQL] Table structure and foreign keys - by Kaperstone - 22.07.2017, 04:00
Re: [MySQL] Table structure and foreign keys - by Tass007 - 22.07.2017, 05:04
Re: [MySQL] Table structure and foreign keys - by Kaperstone - 22.07.2017, 16:25
Re: [MySQL] Table structure and foreign keys - by Tass007 - 22.07.2017, 19:30
Re: [MySQL] Table structure and foreign keys - by Banditul18 - 18.10.2017, 13:50

Forum Jump:


Users browsing this thread: 4 Guest(s)