Hi, can anyone tell me the advantages of alias name

Recommended Answers

All 6 Replies

It increases readability of the query result, and can shorten long queries.

Thanq.. but Other than that, is there any other advantages ??

alias name has several advantages.

  1. The readability of a QUERY(MOSTLY USED WITH SELECT STATEMENT) can be improved by giving a table an alias, also known as a correlation name or range variable. A table alias can be assigned either with or without the AS keyword:

* table_name AS table alias
* table_name table_alias.
2. This can also be useful on using self join.

I have a class that builds my html tables dynamically along with the table headers to show query results, I use an alias for some of the columns to change them to something different that I want to show in my html table. I assume we're talking about all types of aliases, so I thought I would through this in there too.

If same column name is found in a join query of two or more tables then you must use table alias.

There is a certain query that you can use to check a table for duplicate records. This requires doing a JOIN on a table with itself. As far as I know, the only way to do this is by creating two aliases for the same table.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.