What is "alias" in db_select() function? Beginner Drupal Developer. The drupal API didn't provide info for what purpose the $alias must be used in db_select? And what is that anyway?
In Drupal database API alias means exactly the same thing it means in SQL world - short name assigned to table or field to simplify further referencing it during this one query. Some table names are pretty long, and you can't always count on Drupal to be able to resolve prefixes, so aliasing mystupidlongprefix_field_revision_field_some_pretty_long_name_for_field_containing_a_gallery with something simple, like frg (field revision gallery), or something other you will recognize when you will read this query, both make it way easier and faster to write and understand code, and also allows you to use this table for example in conditions, where using {table_name} syntax for automatic prefixes is not always feasible.