Database designing - for vehicles application - mysql

I am trying to build vehicle application but I am confused about the table structure currently I have created those tables according to tire specifications. Would you check out the design structure and correct me if something missing. ERD Diagram uploaded with more explanation about the diagram.

I would split the "ty_tires" table into two separate tables:
"ty_model" - for tyre model
"ty_version" - for a version of a particular model
The ty_model table would need to have a many-to-one relationship with ty_season, ty_brand and ty_version. The ty_version table would need to have a many-to-one relationship with ty_width, ty_profile, ty_diameter, ty_speed, ty_load.

Related

How to create this structure in mysql databases

I need to create such a structure, there is a category of products, each category stores its own information, for example, be entered phone information when selecting a phone category, computer information must be entered when selecting a computer category, How to create this structure in a clean database? , how is it done in a real project?
Before creating a 'structure' in a DB you need to design your Entity-Relationship Diagram.
This means that you need to decide the Entities of your problem, these would be your tables later in the DB, the Relationships between the entities, these have multiple ways that can be depicted in the tables based mainly on their cardinality and then the properties of the entities, which will be the fields of the tables in your DB.
I think that you need to start from that, create the ER Diagram and then try to model it into the DB.

Grails not generating all SQL tables in many-to-many

I'm a new to Grails and have started a project, but I'm having troubles finding out what is wrong:
The project is already connected to my database (SQL) and it has a few many-to-many to relationship with more than 1 "parameter", like this:
static hasMany = [rules:AvaliateRules,professors:Professor,candidates:Candidate];
I run the application with no problems, but when I used show tables the transaction tables weren't all created. It just created the last parameter's table (candidate).
Any idea about the reason and how to fix it? everywhere I checked, people did the same as me and had no problems with the tables. I'm using grails 2.4.4 version.
I don't think that your current domain has many-to-many relationship with all entities that you mentioned. It might be a one-to-many relationship. Let's say your current domain is "DomainA". If only other domain like AvaliateRules,Professor has "DomainA" in hasMany then it makes it a many-to-many association.
In one-to-many association, only a column is added at the child level(many side) which contains a parentId to denote who the parent is.

Many-to-many dimensions in a datawarehouse using Mondrian schema

I'm using mondrian-olap JRuby gem to query a datawarehouse using Mondrian library. I'm trying to build the OLAP schema but i'm having trouble setting a dimension composed by a many-to-many relationship.
I have a product with many categories, and so I created a table Product, a table ProductCategory and a table Category. The number of products is always increasing and so, using a single ProductCategory table seems a bit risky to me.
The Mondrian documentation was inconclusive for me, and all existing schema examples with a snowflake schema use only a single relationship table (like ProductCategory) and not a many-to-many combination of ones.
Is it possible to represent a many-to-many relationship using a Mondrian schema? Is there a better way to set this relationship?
Mondrian does not support many-to-many relationships. This is a feature that we have already started looking into, but there are no ETA as of now.

One to many relationship in ER diagram, MySQL Workbench

Hi I'm drawing an ER Diagram using MySQL Workbench for my final year project. It's about a shipping company, where buyer & shipping agent are involved in a shipping process with my client.
So far the buyer and agent have same attributes. So I decided to keep both of their data in a table and differentiate them using an attribute (type in my case).
As you see in my picture I couldn't able to make a N:M relationship between shipping table and external table. It always give me 1:M relationship. When I try to do the relationships manually it creates a another relational table and make a 1:M relation with it.
Can anyone assist me with my problem? Further how efficient to have a relational table in my case.

What's the best way to design an Entity / Relationship Model?

For example if I have 20 tables, I have to design it by section? i.e
CLIENT (id, name...) -- orders -- ODERS_DETAIL(id, products...)
.
.
.
lives --- ADDRESS(...)
Or I can use The MySQL Workbench EER Model (To me, it looks like the Pysical Model)?
Or like this: Data Modeling Levels
Well, I would not do it in code. That is for the RDBMS itself.
MySQL EER Workbench does not do true entity modeling - it is modeling tables, you are correct.
If you want true ER modeling I suggest Oracle's newly released ('Early Adopter') SQL Developer Data Modeler.
It is pretty easy to use, is free and can forward and reverse engineer models to tables. http://www.oracle.com/technetwork/developer-tools/datamodeler/overview/index.html
When in doubt, design a table that is totally flat, and then determine where you have duplicated data, these can be considered for tables (entities).
The "ER model" defines entities unto themselves and allow the reference of entity-to-entity (table-to-table) through a separate relation. If you can remove yourself from thinking about foreign keys in your entities and focus on the relations in their own separate table.