db advanced sql