-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSQL Server Alias.sql
More file actions
65 lines (52 loc) · 1.1 KB
/
Copy pathSQL Server Alias.sql
File metadata and controls
65 lines (52 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
SELECT
[first_name],
[last_name]
FROM sales.customers
ORDER BY [first_name];
GO
SELECT
[first_name] + ' ' + [last_name]
FROM sales.customers
ORDER BY [first_name];
GO
SELECT
[first_name] + ' ' + [last_name] AS full_name
FROM sales.customers
ORDER BY [first_name];
GO
SELECT
[first_name] + ' ' + [last_name] AS 'full_name'
FROM sales.customers
ORDER BY [first_name];
GO
SELECT
category_name 'Product Category'
FROM production.categories;
GO
SELECT
category_name 'Product Category'
FROM production.categories
ORDER BY category_name;
GO
SELECT
category_name 'Product Category'
FROM production.categories
ORDER BY 'Product Category';
GO
-- TABLE ALIAS
SELECT
sales.customers.customer_id,
[first_name],
[last_name],
[order_id]
FROM sales.customers
INNER JOIN sales.orders ON sales.customers.customer_id = sales.orders.customer_id;
GO
SELECT
c.customer_id,
[first_name],
[last_name],
[order_id]
FROM sales.customers AS c
INNER JOIN sales.orders as o ON c.customer_id = o.customer_id;
GO