4 ms·
I came here to say the exact same thing. The other nice benefit is that, when you list the fields you're retrieving, it functions like a mini-reference as you
by crazygringo 13y ago
I came here to say the exact same thing.
The other nice benefit is that, when you list the fields you're retrieving, it functions like a mini-reference as you write/modify your query, so you don't have to keep switching to the schema to see if it's called "id" or "row_id", if it's "package_name" or "pkgname"...
To me, "SELECT *" almost feels like using your variables without declaring them first -- not technically wrong in many languages, but still uncomfortable-feeling.
- tuananh 13y agoto me SELECT * is like var in C#
- S_A_P 13y agoI don't understand the var hatred in c#. Why type a type name twice? I can understand a function result needing to be explicitly typed but why do this? StringBuilder stringBuilder = new StringBuilder(); That is horrendously redundant. Var is handy shorthand and should be used!!
- tuananh 13y agowhen declare and init an obj with constructor, yes it's annoying to type the type twice and I def. use `var` But what if you're doing something like var x = myOtherObjectName.y; readability is destroyed in this case.
- eru 13y agoTo provide an alternative view, in e.g. Haskell the redundancy would be solved the other way round: (stringBuilder :: StringBuilder) <- construct (Assuming that there was a type class that had construct as a method and StringBuilder was an instance of that class.)