Answer the question
In order to leave comments, you need to log in
How to sample during normalization?
If I understand correctly what normalization is, then here is an example:
Question 1: how can I select all users from Russia in this case, for example? (if there are many cities and countries in the database)
Question 2: if a query is made to a normalized table: SELECT * FROM `юзеры` WHERE `id`='1'
Will it pull out all the data (city, region, country)? Or what would the region and country need to get a JOIN?
How to determine what data to display from a large table and bring to a normal form, and what to leave in a large table? (on 30 fields, for example).
So far, I understand that if the data is read more often, then you can leave it in a large table, but those that are often written should be placed in separate tables, i.e. do normalization.
Answer the question
In order to leave comments, you need to log in
Spherical query in vacuum:
SELECT `юзеры`.*
FROM `юзеры`
INNER JOIN `города`
ON `города`.`id` = `юзеры`.`город_id`
INNER JOIN `области`
ON `области`.`id` = `города`.`область_id`
INNER JOIN `страны`
ON `страны`.`id` = `области`.`страна_id`
WHERE `страны`.`страна` = 'Россия'
For this case, see nosql databases . There are multidimensional connections here.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question