mardi 14 juin 2016

Similar Results Comparison Solution

I have 2 solutions for this and want to learn which one is great ( or another solution that makes it better)

Tables:
----------
Model: ID(like seflink - primary) | Phone | Location ID
Model_Info: Phone(Primary key) | Height | Weight | Skin | Hair | Eye | Meet_Place

Here is my problem I want to find similar Models for 1 model. But they are not easy I cannot use like operator there is more Comparison info. I'm thinking about score system.


For example:

Model 1 (Our selected model): 000 | 1.70 | 50 | Bold | Red | Green | House

Model 2 (one of many): 235 | 1.72 | 55 | Blonde | Red | Green | House

Here is a thing I want to go for Height for example one 1.70 vs 1.72. We will do this in this part ((1-abs((1.70-1.72)))*2) + total_score. This system goes on in another columns too. Some of them is harder like bold and blonde.

Finally problem is I dont want to make this Comparison every single time page opens so I want to go for creating another table named Comp_Scores. Here is my plan I will add some triggers on model instert & update that re calculating scores for that modal. Another trigger will delete trigger that deletes scores for that modal.

Any other ideas & code examples for this problem ?

Thank you,

Example data

100 | 1.60 | 60 | White    | Blonde     | Brown | House -> Selected one

010 | 1.70 | 55 | Wheat    | Red    | Green | House -> 
001 | 1.74 | 49 | Brunette | Black  | Blue  | House
002 | 1.56 | 65 | Brunette | Auburn | Green | House
030 | 1.69 | 80 | White    | Blonde     | Blue  | House
050 | 1.82 | 53 | Bold     | Auburn | Green | House
006 | 1.58 | 65 | Wheat    | Black  | Hazel | House
400 | 1.65 | 77 | White    | Red    | Brown | House
050 | 1.66 | 59 | Bold     | Red    | Hazel | House

Aucun commentaire:

Enregistrer un commentaire