Select Name and Salary
EasySQLDatabaseSorting
Description
Write a SQL query to select the name and salary of every employee, ordered by id ascending. **Output columns (in order):** name, salary
Table:
employees| Column | Type |
|---|---|
| id | INT |
| name | TEXT |
| salary | INT |
| department | TEXT |
Examples
Input:
CREATE TABLE employees (id INT, name TEXT, salary INT, department TEXT); INSERT INTO employees VALUES (1,'Alice',50000,'Eng'),(2,'Bob',60000,'Sales'),(3,'Cara',55000,'Eng');Output:
Alice|50000
Bob|60000
Cara|55000Explanation:
The query keeps only the name and salary columns for every employee and returns them ordered by id.
Input:
CREATE TABLE employees (id INT, name TEXT, salary INT, department TEXT); INSERT INTO employees VALUES (3,'Dan',70000,'HR'),(1,'Eve',45000,'Eng'),(2,'Fay',62000,'Sales');Output:
Eve|45000
Fay|62000
Dan|70000Explanation:
The query keeps only the name and salary columns for every employee and returns them ordered by id.
Input:
CREATE TABLE employees (id INT, name TEXT, salary INT, department TEXT); INSERT INTO employees VALUES (1,'Gil',30000,'Ops');Output:
Gil|30000Explanation:
The query keeps only the name and salary columns for every employee and returns them ordered by id.
Constraints
- •
Use standard SQL (SQLite).