SQL Aliases
SQL Aliases
테이블, 테이블 명의 임시 이름을 지정한다.
AS
Alias Column Syntax
SELECT column_name AS alis_name
FROM table_name;
Alias Table Syntax
SELECT column_name(s)
FROM table_name AS alis_name;
Alias for Columns Example
SELECT CustomerID AS ID, CustomerName AS Customer
FROM Customers;
SELECT CustomerName AS Customer, ContactName AS [Contact Person]
FROM Customers;
SELECT CustomerName, Address+', '+PostalCode+' ' + City+', '+ Country AS Address
FROM Customers;
Alias for Tables Example
SELECT o.OrderID, o.OrderDate, c.CustomerName
FROM Customers AS c, Orders AS o
WHERE c.CustomerName='Around the Horn' AND c.CustomerID=o.CustomerID;
SELECT Orders.OrderID, Orders.OrderDate, Customers.CustomerName
FROM Customers, Orders
WHERE Customers.CustomerName='Around the Horn' AND Customers.CustomerID=Orders.CustomerID;
'Computer Science > Database' 카테고리의 다른 글
W3Schools SQL | #20 SQL INNER JOIN 키워드 (0) | 2022.10.28 |
---|---|
W3Schools SQL | #19 SQL JOINS (0) | 2022.10.28 |
W3Schools SQL | #17 SQL BETWEEN 연산자 (0) | 2022.10.28 |
W3Schools SQL | #16 SQL IN OPERATOR (0) | 2022.10.27 |
W3Schools SQL | #15 SQL WILDCARDS 문자열 (0) | 2022.10.27 |