Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> The goal absolutely IS to select columns from a table.

No. The goal is to have an output column $FOO, where $FOO is meaningful and might not even be in the database in the first place.

> my goal is not to select created_at, my goal is to select Foo's created_at.

Then your goal is to get a value out of a specific table, namely `Foo`, presumably because the end-user wants to see some value in the results.

The end-user getting the value has neither an interest in nor knowledge of your schema. `Foo.created_at` is no more meaningful in the result sets than an unadorned `created_at`.

For this specific example, the end-user might want a column in the output called `age` (if it came from an inventory table`, or `duration` (if it came from a metrics tables), or perhaps `expiry` (if it is a table containing perishable stock). These are all a column in a Foo table, but the request that caused you to write the query in the first place does not mention table at all.

You get their requirement as either `age`, `duration`, `expiry` or similar. That is what you are starting from: "a need for a specific piece of data". You are not starting from "a need from a specific table", because the information needed is coming from someone who neither knows nor cares what your schema looks like.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: