Selecting columns

Suppose you need emp_no and dept_no from dept_manager:

mysql> SELECT emp_no, dept_no FROM dept_manager;+--------+---------+| emp_no | dept_no |+--------+---------+| 110022 | d001    || 110039 | d001    || 110085 | d002    || 110114 | d002    || 110183 | d003    || 110228 | d003    || 110303 | d004    || 110344 | d004    || 110386 | d004    || 110420 | d004    || 110511 | d005    || 110567 | d005    || 110725 | d006    || 110765 | d006    || 110800 | d006    || 110854 | d006    || 111035 | d007    || 111133 | d007    || 111400 | d008    || 111534 | d008    || 111692 | d009    || 111784 | d009    || 111877 | d009    || 111939 | d009    |+--------+---------+24 rows in set (0.00 sec)

Get MySQL 8 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.