Search code examples
selecterlangmnesia

Erlang mnesia equivalent of "select * from Tb"


I'm a total erlang noob and I just want to see what's in a particular table I have. I want to just "select *" from a particular table to start with. The examples I'm seeing, such as the official documentation, all have column restrictions which I don't really want. I don't really know how to form the MatchHead or Guard to match anything (aka "*").

A very simple primer on how to just get everything out of a table would be very appreciated!


Solution

  • For example, you can use qlc:

    F = fun() ->
                Q = qlc:q([R || R <- mnesia:table(foo)]),
                qlc:e(Q)
        end,
    mnesia:transaction(F).