티스토리 뷰

프로그래밍/C#

mysql join 실습 예제

뽀로로친구에디 2018. 9. 22. 00:29

mysql join 실습 예제 


MariaDB [opentutorials]> select * from topic;

+----+------------+------------------+---------------------+-----------+

| id | title      | description      | created             | author_id |

+----+------------+------------------+---------------------+-----------+

|  1 | my sql     | mysql is...      | 2018-09-22 00:12:27 |         1 |

|  2 | oracle     | oracle is...     | 2018-09-22 00:13:38 |         1 |

|  3 | sql server | sql server is... | 2018-09-22 00:14:37 |         2 |

|  4 | postgresql | postgresql is... | 2018-09-22 00:17:48 |         3 |

|  5 | mongodb    | mongodb is...    | 2018-09-22 00:18:51 |         1 |

+----+------------+------------------+---------------------+-----------+

5 rows in set (0.00 sec)



MariaDB [opentutorials]> select * from author;

+----+--------+---------------------------+

| id | name   | profile                   |

+----+--------+---------------------------+

|  1 | egoing | developer                 |

|  2 | duru   | data administrator        |

|  3 | taeho  | data scientist, developer |

+----+--------+---------------------------+

3 rows in set (0.00 sec)




MariaDB [opentutorials]>  select * from topic left join author on topic.author_id = author.id;

+----+------------+------------------+---------------------+-----------+------+--------+---------------------------+

| id | title      | description      | created             | author_id | id   | name   | profile                   |

+----+------------+------------------+---------------------+-----------+------+--------+---------------------------+

|  1 | my sql     | mysql is...      | 2018-09-22 00:12:27 |         1 |    1 | egoing | developer                 |

|  2 | oracle     | oracle is...     | 2018-09-22 00:13:38 |         1 |    1 | egoing | developer                 |

|  3 | sql server | sql server is... | 2018-09-22 00:14:37 |         2 |    2 | duru   | data administrator        |

|  4 | postgresql | postgresql is... | 2018-09-22 00:17:48 |         3 |    3 | taeho  | data scientist, developer |

|  5 | mongodb    | mongodb is...    | 2018-09-22 00:18:51 |         1 |    1 | egoing | developer                 |

+----+------------+------------------+---------------------+-----------+------+--------+---------------------------+

5 rows in set (0.01 sec)





'프로그래밍 > C#' 카테고리의 다른 글

윈도우에 MySQL설치하기  (0) 2018.09.25
맥(mysqlworkbench)를 이용해 라즈베리파이 mysql 원격제어  (0) 2018.09.22
mysql 테이블 분리하기  (0) 2018.09.22
mysql delete문 실습  (0) 2018.09.21
mysql update 문 실습  (0) 2018.09.21
댓글
최근에 달린 댓글
글 보관함
«   2024/12   »
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
Total
Today
Yesterday
    뽀로로친구에디
    최근에 올라온 글