Database / Mnesia basics Interview questions
What is the primary key in a Mnesia table?
The primary key of a Mnesia table is always its first declared attribute — there's no separate syntax
to mark a different field as the key the way some databases let you designate an arbitrary column. Every
lookup by mnesia:read/1 or mnesia:dirty_read/1 is keyed on this first field.
-record(person, {id, name, age}). %% id is the primary key mnesia:read({person, 1}). %% looks up by id = 1
On a set or ordered_set table, this key must be unique — writing a new
record with an existing key's value overwrites the old one. On a bag table, the same key value
can appear across multiple distinct records, since uniqueness isn't enforced for that table type.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
