Determines all employees whose names contain the sequence of letters er. : Simple Select « Select Clause « SQL / MySQL






Determines all employees whose names contain the sequence of letters er.

       
mysql>
mysql>
mysql> CREATE TABLE employee (
    ->     id int unsigned not null auto_increment primary key,
    ->     firstname varchar(20),
    ->     lastname varchar(20),
    ->     title varchar(30),
    ->     age int,
    ->     yearofservice int,
    ->     salary int,
    ->     perks int,
    ->     email varchar(60)
    -> );
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql> INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, email) values ("John", "Chen
", "Senior Programmer", 31, 3, 120000, 25000, "j@hotmail.com");
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, email) values ("Jan", "Pilla
i", "Senior Programmer", 32, 4, 110000, 20000, "g@yahoo.com");
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, email) values ("Ane", "Pandi
t", "Web Designer", 24, 3, 90000, 15000, "a@gmail.com");
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, email) values ("Mary", "Anch
or", "Web Designer", 27, 2, 85000, 15000, "m@mail.com");
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, email) values ("Fred", "King
", "Programmer", 32, 3, 75000, 15000, "f@net.com");
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, email) values ("John", "Mac"
, "Programmer", 32, 4, 80000, 16000, "j@hotmail.com");
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, email) values ("Arthur", "Sa
m", "Programmer", 28, 2, 75000, 14000, "e@yahoo.com");
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, email) values ("Alok", "Nand
a", "Programmer", 32, 3, 70000, 10000, "a@yahoo.com");
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, email) values ("Susan", "Ra"
, "Multimedia Programmer", 32, 4, 90000, 15000, "h@gmail.com");
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, email) values ("Paul", "Simo
n", "Multimedia Programmer", 23, 1, 85000, 12000, "ps@gmail.com");
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, email) values ("Edward", "Pa
rhar", "Multimedia Programmer", 30, 2, 75000, 15000, "a@hotmail.com");
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, email) values ("Kim", "Hunte
r", "Senior Web Designer", 32, 4, 110000, 20000, "kim@coolmail.com");
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, email) values ("Roger", "Lew
is", "System Administrator", 32, 3, 100000, 13000, "roger@mail.com");
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, email) values ("Danny", "Gib
son", "System Administrator", 31, 2, 90000, 12000, "danny@hotmail.com");
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, email) values ("Mike", "Harp
er", "Senior Marketing Executive", 36, 1, 120000, 28000, "m@gmail.com");
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, email) values ("Mary", "Sund
ay", "Marketing Executive", 31, 5, 90000, 25000, "monica@bigmail.com");
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, email) values ("Jack", "Sim"
, "Marketing Executive", 27, 1, 70000, 18000, "hal@gmail.com");
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, email) values ("Joe", "Irvin
e", "Marketing Executive", 27, 1, 72000, 18000, "joseph@hotmail.com");
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, email) values ("Henry", "Ali
", "Customer Service Manager", 32, 3, 70000, 9000, "shahida@hotmail.com");
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, email) values ("Peter", "Cha
mpion", "Finance Manager", 32, 2, 120000, 25000, "peter@yahoo.com");
Query OK, 1 row affected (0.00 sec)

mysql>
mysql>
mysql> SELECT firstname FROM employee WHERE firstname LIKE '%er%';
+-----------+
| firstname |
+-----------+
| Roger     |
| Peter     |
+-----------+
2 rows in set (0.00 sec)

mysql>
mysql> drop table employee;
Query OK, 0 rows affected (0.00 sec)

   
    
    
    
    
    
    
  








Related examples in the same category

1.Explain select command
2.Get the number, name, and date of birth of each player resident in Stratford; sort the result in alphabetical
3.Do math calculation with select
4.SELECT statement includes three select list elements
5.Select rows
6.The expression in the select list subtracts the Reserved value from the total
7.Removing duplicates and selecting only the unique combinations of values in the specified columns
8.Display the names of only those authors whose surname starts with one of the letters L through Z:
9.Use a wildcard (*) to return all the fields
10.Using mysql as a Calculator
11.Identifying What Values to Display
12.Using the aliases p1 and p2 to refer to the book table different ways