Home > Software engineering >  Erlang Database Join Association
Erlang Database Join Association

Time:05-04

Iam just wondering how to implement Mnesia tables join association efficiently, in other terms I want to know how to implement Nested SQL queries in Mnesia, for example consider we have 3 tables : Person(id, name) , Car(id, color) and Drive(id_person, id_car), and the query is to get the Names of Persons that Drive Black Cars, in SQL Database the Nested Query is as follows :

SELECT name
FROM Person
WHERE id in (SELECT id_person
             FROM Drive
             WHERE id_car in (SELECT id
                              FROM car
                              WHERE color = black))

so my question is how to do that with Mnesia functions (read, select, foldl,....) not with QLC ? I will be thankful for any help.

CodePudding user response:

I think you should implement the query by your program by search table one by one.

  • Related