I
I
Igor2019-11-15 02:20:49
MySQL
Igor, 2019-11-15 02:20:49

MySql database normalization in my case?

Colleagues, hello!
Need advice for optimal database normalization.

I give a model, how I plan to extract data from it.

{
 ...
  "features": [
    {
      "id": "car_brand",
      "value": [
        "спецтехника",
        "Chevrolet",
        "Ford",
        "отечественные",
        "легковые",
        "импортные",
        "Citroen",
        "Opel",
        "Peugeot",
        "коммерческие"
      ],
      "name": "марка автомобиля",
      "type": "enum"
    },
    {
      "id": "test_drive",
      "value": true,
      "name": "тест-драйв",
      "type": "bool"
    },
    {
      "id": "trade_in",
      "value": true,
      "name": "трейд-ин",
      "type": "bool"
    },
    {
      "id": "arts",
      "value": [
        "для иномарок",
        "для легковых автомобилей",
        "для микроавтобусов"
      ],
      "name": "запчасти",
      "type": "enum"
    },
    {
      "id": "loan_processing",
      "value": true,
      "name": "автокредит",
      "type": "bool"
    },
    {
      "id": "leasing_registration",
      "value": true,
      "name": "лизинг",
      "type": "bool"
    },
    {
      "id": "payment_by_credit_card",
      "value": true,
      "name": "оплата картой",
      "type": "bool"
    },
    {
      "id": "authorized_service",
      "value": true,
      "name": "официальный автосервис",
      "type": "bool"
    },
    {
      "id": "tire_fitting",
      "value": true,
      "name": "шиномонтаж",
      "type": "bool"
    },
    {
      "id": "basic_service",
      "value": true,
      "name": "базовое сервисное обслуживание",
      "type": "bool"
    },
    {
      "id": "registration_inspection",
      "value": true,
      "name": "постановка на учёт, техосмотр",
      "type": "bool"
    },
    {
      "id": "wheel_alignment",
      "value": true,
      "name": "развал-схождение",
      "type": "bool"
    },
    {
      "id": "wi_fi",
      "value": true,
      "name": "Wi-Fi",
      "type": "bool"
    },
    {
      "id": "cafe",
      "value": true,
      "name": "кафе",
      "type": "bool"
    },
    {
      "id": "auto_insurance_type",
      "value": [
        "Каско/Осаго"
      ],
      "name": "автострахование",
      "type": "enum"
    },
    {
      "id": "auto_sales",
      "value": [
        "с пробегом",
        "новые"
      ],
      "name": "продажа автомобилей",
      "type": "enum"
    },
    {
      "id": "car_repairs",
      "value": [
        "заправка и ремонт автокондиционера",
        "ремонт тормозной системы",
        "ремонт АКПП",
        "ремонт двигателя",
        "полное сервисное обслуживание",
        "замена масла",
        "установка парктроника",
        "тонировка стекол",
        "ремонт ходовой части",
        "компьютерная диагностика автомобиля",
        "ремонт автоэлектрики",
        "сигнализация",
        "ремонт КПП"
      ],
      "name": "виды работ",
      "type": "enum"
    },
    {
      "id": "official_dealer",
      "value": true,
      "name": "официальный дилер",
      "type": "bool"
    },
    {
      "id": "automotive_parts",
      "value": [
        "Ford",
        "Chevrolet",
        "спецтехники",
        "Opel",
        "отечественных",
        "легковых",
        "импортных",
        "коммерческих"
      ],
      "name": "автомобили",
      "type": "enum"
    }
  ]
}


There is an
Organization.php entity - an organization (school, hospital, shop, ...)
The organization provides some services.
Above gave an example, the services of one unit of the company.
Total companies > [ 5,000,000 - ‎ ∞ ]
I am assuming that I will have the following entities.
Organization.php
Feature.php
FeatureValue.php

Which leads to the question, is this correct?
Does it make sense to create unique entries for
Feature.php
FeatureValue.php
Or vice versa would be the right solution.
Due to the fact that we do not have to create duplicate records.
But even here, not everything is smooth, but what if we delete a company that refers to a service whose service refers to another company?
Diagram
5dce834a18c1d322575700.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lazy @BojackHorseman MySQL, 2019-11-15
@IgorPI

your reasoning has nothing to do with normalization

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question