Exercise 1
beginnerQuestion
Write a query to select all columns from the 'employees' table.
Table Schema
CREATE TABLE employees (
id INT PRIMARY KEY,
name VARCHAR(100),
salary DECIMAL(10,2),
department VARCHAR(50),
hire_date DATE
);Show Solution
Solution
1SELECT * FROM employees;Expected Output
| id | name | salary | department | hire_date | |---|---|---|---|---| | 1 | John | 50000 | Sales | 2024-01-15 |
Explanation
The asterisk (*) is a wildcard that selects all columns from the specified table. While convenient for exploration, in production code it's better to explicitly list column names.