The following SQL schema will produce the table below.
Create table If Not Exists Employees (employee_id int, name varchar(30), salary int);
Truncate table Employees;
insert into Employees (employee_id, name, salary) values ('2', 'Meir', '3000');
insert into Employees (employee_id, name, salary) values ('3', 'Michael', '3800');
insert into Employees (employee_id, name, salary) values ('7', 'Addilyn', '7400');
insert into Employees (employee_id, name, salary) values ('8', 'Juan', '6100');
insert into Employees (employee_id, name, salary) values ('9', 'Kannon', '7700');
employee_id | name | salary |
---|---|---|
2 | Meir | 3000 |
3 | Michael | 3800 |
7 | Addilyn | 7400 |
8 | Juan | 6100 |
9 | Kannon | 7700 |
Let's say we want to select the name column where the name begins with the letter "M".
We can do this by using the LEFT()
function inside of a WHERE
clause.
SELECT name
FROM Employees
WHERE LEFT(name, 1) = "M";
name |
---|
Meir |
Michael |