T-SQL reference › Aliases
Table and column aliases in SQL Server
A column alias is the header in the grid. A table alias is the short name in a join. Miss the column alias on ISNULL and you get “(No column name)”.
Readable join
SELECT o.order_id,
c.first_name + ' ' + c.last_name AS customer,
ISNULL(c.phone, 'No phone') AS phone
FROM Orders o
JOIN Customers c ON c.customer_id = o.customer_id;
AS is optional. Use it. customer = at the front (equals alias) is an old style. Stick to AS.
Try it on Harbour & Co
James Rowe (Sales Manager) needs this now: “Can you resend last week’s orders with the customer’s name instead of their ID? Newest first.” Write the query, run it, send the results. Free.
Take the ticket →Learn it on a real ticket
Monday is free on WorkSQL. A colleague’s ticket lands, you write the T-SQL, we mark it. No videos. Five minutes.
Clock in free See Monday’s tickets