O'Reilly logo

MySQL 8 Cookbook by Karthik Appigatla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

Select all data from the departments table of the employee database. You can use an asterisk (*) to select all columns from a table. It is not recommended to use it, you should always select only the data you need:

mysql> SELECT * FROM departments;+---------+--------------------+| dept_no | dept_name          |+---------+--------------------+| d009    | Customer Service   || d005    | Development        || d002    | Finance            || d003    | Human Resources    || d001    | Marketing          || d004    | Production         || d006    | Quality Management || d008    | Research           || d007    | Sales              |+---------+--------------------+9 rows in set (0.00 sec)

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required