MS SQL Server Concepts and Programming Question: Download Questions PDF
How To Define and Use Table Alias Names in MS SQL Server?
![MS SQL Server Interview Answer MS SQL Server Interview Question](https://globalguideline.com/public/images/interview/13.png)
Answer:
When column names need to be prefixed with table names, you can define table alias name and use them to prefix column names. To define an alias for a table name, just enter the alias name right after the original table name in the FROM clause as shown in the following select statement:
SELECT l.id, l.url, r.comment FROM ggl_links l
INNER JOIN ggl_rates r ON l.id = r.id
GO
id url comment
101 www.globalguideline.com The best
102 www.globalguideline.com/html Well done
103 www.globalguideline.com/sql Thumbs up
SELECT l.id, l.url, r.comment FROM ggl_links l
INNER JOIN ggl_rates r ON l.id = r.id
GO
id url comment
101 www.globalguideline.com The best
102 www.globalguideline.com/html Well done
103 www.globalguideline.com/sql Thumbs up
Download MS SQL Server Interview Questions And Answers
PDF
Previous Question | Next Question |
How To Write a Query with an Inner Join in MS SQL Server? | How To Write a Query with a Left Outer Join in MS SQL Server? |