The best query builder I’ve seen is Kysely and it works because of anonymous sum types. So far no other library in any other language has come remotely close. You’d think Rust would have that level of type safety, but alas no.

Typescript is magic: https://kysely.dev/docs/examples/select/aliases

    const persons = await db
      .selectFrom('person as p')
      .select([
        'first_name as fn',
        'p.last_name as ln'
      ])
      .execute()