EXPLAIN EXTENDED

How to create fast database queries

Archive for March 27th, 2009

Sorting lists: adding items

Comments enabled. I *really* need your comment

This is article 3 of 6 on linked lists in MySQL:

In this article I'll cover inserting items into the linked list.

This is quite a simple task, but has some issues we will need to handle.

When we insert a new item A after an existing item B in the linked list, we need to do the following:

  1. Insert the new item and set its parent to B
  2. Update the B's child's parent to A

This seems OK, but what if we want the id of A to be autogenerated?
Read the rest of this entry »

Written by Quassnoi

March 27th, 2009 at 11:00 pm

Posted in MySQL