My criticism wouldn't be about SQL in the frontend code, but how disconnected this example is from reality. In a typical enterprise environment, the front end doesn't have direct database access. It will use APIs, AuthN, AuthZ, RBAC, etc... Who's the target audience of this?
i'm not sure man







