Columns of table "linked_list": unique_id integer (unique) list_id integer (indexed) next_id : integer (FK unique_id) value : ??? List [A, B] with id 42: (1, 42, 2, A) (2, 42, null, B) List [ x,y,z ] with id 123: (3, 123, 4, x) (4, 123, 5, y) (5, 123, null, z) Now I insert new value Q between x and y in list 123: UPDATE: (3, 123, 6, x) INSERT: (6, 123, 4, Q) You know that 1 and 3 are both heads because no other row links to them. You know 2 and 5 are last items because they reference null. An empty list simply has no rows.