Better foreign keys handling, slightly change SQL clues syntax