Implement sessions in SQL