SQL 添加一列 假数据

场景:两个相同表结构的表合并为一张表,新增一个字段区分不同的源表

mysql> select id,capacity from capacity;
+----+----------+
| id | capacity |
+----+----------+
|  1 |      180 |
|  2 |      190 |
|  3 |      200 |
|  4 |      210 |
|  5 |      224 |
+----+----------+
5 rows in set (0.00 sec)

mysql> select id,capacity,'test' as add_column from capacity;
+----+----------+------------+
| id | capacity | add_column |
+----+----------+------------+
|  1 |      180 | test       |
|  2 |      190 | test       |
|  3 |      200 | test       |
|  4 |      210 | test       |
|  5 |      224 | test       |
+----+----------+------------+
5 rows in set (0.00 sec)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
访客IP ,您的网络 访问优先

本站是个人博客,书写大数据、数据科学等领域的原创学习记录,转载请注明出处

本站运行于 腾讯云 腾讯云