I have experiments, features, and feature_values. Features have values in different experiments. So I have something like:
Experiments:
experiment_id, experiment_name
Features:
feature_id, feature_name
Feature_values:
experiment_id, feature_id, value
Lets say, I have three experiments (exp1, exp2, exp3) and three features (feat1, feat2, feat3). I would like to have a SQL-result that looks like:
feature_name | exp1 | exp2 | exp3
-------------+------+------+-----
feat1 | 100 | 150 | 110
feat2 | 200 | 250 | 210
feat3 | 300 | 350 | 310
How can I do this? Furthermore, It might be possible that one feature does not have a value in one experiment.
feature_name | exp1 | exp2 | exp3
-------------+------+------+-----
feat1 | 100 | 150 | 110
feat2 | 200 | | 210
feat3 | | 350 | 310
The SQL-Query should be with good performance. In the future there might tens of millions entries in the feature_values table. Or is there a better way to handle the data?