GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Database  >  SQL Server
Go To First  |  Previous Question  |  Next Question 
 SQL Server  |  Question 94 of 99    Print  
Table Name Alias
Why do we use alias for the table name? What is its importance?


  
Total Answers and Comments: 5 Last Update: September 23, 2009     Asked by: AnithaBabu1 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: Bhuvaneswari.V
 
Joins Require them if you are using the same table (or view) multiple times. Alias can serve clarify to data source.

Above answer was rated as good by the following members:
shmz7
August 04, 2008 20:53:55   #1  
rarbuckle1982 Member Since: August 2008   Contribution: 1    

RE: Table Name Alias
It is a shorthand notation. Easier to use if you have to reference the table over and over.

SELECT * FROM tbl_Long_Table_Name tbl_Other_Long_Table_Name
WHERE tbl_Long_Table_Name.FieldID tbl_Other_Long_Table_Name.FieldID
AND tbl_Long_Table_Name.FieldID 1

Can be done like this:

SELECT * FROM tbl_Long_Table_Name a tbl_Other_Long_Table_Name b
WHERE a.FieldID b.FieldID
AND a.FieldID 1



 
Is this answer useful? Yes | No
August 05, 2008 04:42:33   #2  
soujanyaj Member Since: July 2007   Contribution: 1    

RE: Table Name Alias

The Alias name is used as a shorthand notation for the tble name for example: if there are 2 tables with long name then it will be difficuilt to call that table hence the alias name is used.

table alias name is also used to remove the ambiguity of the column names used in different tables


 
Is this answer useful? Yes | No
December 03, 2008 04:56:43   #3  
Bhuvaneswari.V Member Since: November 2008   Contribution: 5    

RE: Table Name Alias
Joins Require them if you are using the same table (or view) multiple times. Alias can serve clarify to data source.
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
December 06, 2008 18:54:37   #4  
docjvk Member Since: December 2008   Contribution: 1    

RE: Table Name Alias
Allows table to be used more than once in query allows shorter qualified name.
 
Is this answer useful? Yes | No
September 23, 2009 08:23:57   #5  
goksn Member Since: May 2009   Contribution: 94    

RE: Table Name Alias
-is a shorthand notation
-Will be used along with column name if same colum name present in more than one table (while joining those tables)
-Must in self join

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape