Select every column from a table
Question
Show every column and every row of the employees table.
employeesid, name, salary, department_id, manager_id, hired_on
departmentsid, name, city
Your query
Ctrl+Enter to run
Result
Expected result
| id | name | salary | department_id | manager_id | hired_on |
|---|---|---|---|---|---|
| 1 | Tom Becker | 8800 | 1 | NULL | 2017-03-01 |
| 2 | Ana Souza | 6500 | 2 | NULL | 2018-06-15 |
| 3 | Priya Nair | 9200 | 1 | 1 | 2019-01-07 |
| 4 | Lucas Moreau | 6800 | 2 | 2 | 2020-09-21 |
| 5 | Mei Chen | 7600 | 1 | 1 | 2021-02-01 |
| 6 | Omar Haddad | 5600 | 2 | 2 | 2021-11-08 |
| 7 | Sofia Rossi | 6100 | 3 | NULL | 2019-05-13 |
| 8 | Jonas Berg | 5400 | 3 | 7 | 2022-04-04 |
| 9 | Aisha Bello | 4700 | 4 | NULL | 2020-01-20 |
| 10 | Diego Ruiz | 4100 | 4 | 9 | 2023-03-06 |
| 11 | Hana Kim | 7300 | 1 | 1 | 2022-08-29 |
| 12 | Liam Walsh | 4300 | 4 | 9 | 2024-01-15 |
Hint
The star after SELECT means "all columns".
Show the solution
solution.sql
Run this code
SELECT *
FROM employees;
Why it works
SELECT * returns all columns in the order they were created, and with no WHERE clause every row comes back. It is the quickest way to look at a table you do not know yet.
Common mistake
In real projects, avoid SELECT * in saved queries and reports. Name the columns you need, so the query keeps working when someone adds a column.