For these exercises I've created a db fiddle you can interact with, that comes with a table and data. Feel free to use it so you don't have to set up your table and data yourself!
Select every column from the users table provided:
CREATE TABLE users (id INTEGER, first_name TEXT, surname TEXT, salary INTEGER); INSERT INTO users VALUES (1, 'Rolf', 'Smith', 55000); INSERT INTO users VALUES (2, 'Bob', 'Smith', 45000); INSERT INTO users VALUES (3, 'Anne', 'Pun', 87000);
Select just the surname and salary of the users using the same data as above.
Here's the solution for exercise 1:
SELECT * FROM users;
Which would give you this output:
| id | first_name | surname | salary | | --- | ---------- | ------- | ------ | | 1 | Rolf | Smith | 55000 | | 2 | Bob | Smith | 45000 | | 3 | Anne | Pun | 87000 |
Here's the solution for exercise 2:
SELECT surname, salary FROM users;
Which would give you this output:
| surname | salary | | ------- | ------ | | Smith | 55000 | | Smith | 45000 | | Pun | 87000 |