티스토리 뷰
> select * from topic;
+----+------------+-------------------+---------------------+-----------+
| id | title | description | created | author_id |
+----+------------+-------------------+---------------------+-----------+
| 1 | MySQL | MySQL is... | 2018-01-01 12:10:11 | 1 |
| 2 | Oracle | Oracle is .... | 2018-01-03 13:01:10 | 2 |
| 3 | SQL Server | SQL Server is ... | 2018-01-20 11:01:10 | 2 |
| 4 | PostgreSQL | PostgreSQL is ... | 2018-01-23 01:03:03 | 3 |
| 5 | MongoDB | MongoDB is ... | 2018-01-30 12:31:03 | 4 |
+----+------------+-------------------+---------------------+-----------+
5 rows in set (0.0055 sec)
> select * from author;
+----+---------+---------------------------+
| id | name | profile |
+----+---------+---------------------------+
| 1 | egoing | developer |
| 2 | kio | database administrator |
| 3 | freebee | data scientist, developer |
| 4 | cookieg | CIO of cookio |
+----+---------+---------------------------+
> select * from topic left join author on topic.author_id=author.id;
+----+------------+-------------------+---------------------+-----------+----+---------+---------------------------+
| id | title | description | created | author_id | id | name | profile |
+----+------------+-------------------+---------------------+-----------+----+---------+---------------------------+
| 1 | MySQL | MySQL is... | 2018-01-01 12:10:11 | 1 | 1 | egoing | developer |
| 2 | Oracle | Oracle is .... | 2018-01-03 13:01:10 | 2 | 2 | kio | database administrator |
| 3 | SQL Server | SQL Server is ... | 2018-01-20 11:01:10 | 2 | 2 | kio | database administrator |
| 4 | PostgreSQL | PostgreSQL is ... | 2018-01-23 01:03:03 | 3 | 3 | freebee | data scientist, developer |
| 5 | MongoDB | MongoDB is ... | 2018-01-30 12:31:03 | 4 | 4 | cookieg | CIO of cookio |
+----+------------+-------------------+---------------------+-----------+----+---------+---------------------------+
> select id,title,description,created,name,profile from topic left join author on topic.author_id=author.id;
ERROR: 1052 (23000): Column 'id' in field list is ambiguous
> select topic.id,title,description,created,name,profile from topic left join author on topic.author_id=author.id;
+----+------------+-------------------+---------------------+---------+---------------------------+
| id | title | description | created | name | profile |
+----+------------+-------------------+---------------------+---------+---------------------------+
| 1 | MySQL | MySQL is... | 2018-01-01 12:10:11 | egoing | developer |
| 2 | Oracle | Oracle is .... | 2018-01-03 13:01:10 | kio | database administrator |
| 3 | SQL Server | SQL Server is ... | 2018-01-20 11:01:10 | kio | database administrator |
| 4 | PostgreSQL | PostgreSQL is ... | 2018-01-23 01:03:03 | freebee | data scientist, developer |
| 5 | MongoDB | MongoDB is ... | 2018-01-30 12:31:03 | cookieg | CIO of cookio |
+----+------------+-------------------+---------------------+---------+---------------------------+
'IA > DB' 카테고리의 다른 글
[mysql] 초기 설치 후 샘플 데이터베이스 설치 (0) | 2019.02.28 |
---|---|
[mysql] centos 7 에서 mysql 설치 (0) | 2019.02.28 |
[mysql] table column 명 변경 (0) | 2019.02.26 |
[mysql] delete (0) | 2019.02.26 |
[mysql] update (0) | 2019.02.26 |
- Total
- Today
- Yesterday
- Join
- 대소문자
- EXA
- 차집합
- dp-2
- exadata
- vmware.powercli
- 정렬
- set()
- powershell
- 부동없이
- 스토리지
- sysprep
- cloud-init
- dezoomify
- oracle
- LIST
- powercli
- 배열
- 읽어오기
- insert
- artandculture
- dp-1
- virt-sysprep
- fromkeys
- storage
- 3par
- 변수화
- 중복제거
- vmware
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |