December 14, 2009 at 12:29 pm
While executing a select query, what is the syntax to be included in the query for adding descriptive titles to each column in the result set?
For example if I would like to query the Employee table to return information of Employee ID, First Name, Last Name, Department Name, and Salary, for all employees making more than $90,000, my basic query without column titles would read:
SELECT employeeid, firstname, lastname, department, salary FROM Employee
WHERE salary >= 90000.00;
December 14, 2009 at 12:35 pm
you'll want to use the optional ALIAS for each columnname.
descriptions with spaces require brackets or double quotes.
based on your example, here's what it might look like:
SELECT
employeeid AS [Employee ID],
firstname AS [First Name],
lastname AS [Last Name],
department AS [Department Name],
salary AS [Salary]
FROM Employee
Lowell
December 14, 2009 at 12:43 pm
Thank you, Lowell. That's exactly what I was looking for.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply