How to display employee names starting with a and then b in sql

0 votes
I want to display the names of the employees whose first letters begin with the letters a and b. The list should show the names of the employees whose first letter is 'a' before moving on to 'b'.

Thus if anyone knows the command to display these, please let me know.
Aug 12, 2022 in Database by Kithuzzz
• 38,000 points
1,050 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

To get employee names starting with A or B listed in order: 

select employee_name 
from employees
where employee_name LIKE 'A%' OR employee_name LIKE 'B%'
order by employee_name

If you are using Microsoft SQL Server you could use: 

....
where employee_name  LIKE '[A-B]%'
order by employee_name

This isn't standard SQL however it simply gets meant the accompanying which is.

WHERE  employee_name >= 'A'
       AND employee_name < 'C' 

For all variations you would have to consider whether you need to incorporate highlighted variations, for example, Á and test whether the questions above do what you need with these on your RDBMS and examination choices.

I hope this helps you.

answered Aug 13, 2022 by narikkadan
• 63,600 points

edited Mar 5
0 votes
I hope this will help.

select * from Employees where Name like '[ab]%'
answered Apr 13, 2023 by anonymous

edited Mar 5

Related Questions In Database

0 votes
0 answers
0 votes
0 answers

How to make a query with group_concat in sql server ?

I am aware that the Group Concat ...READ MORE

Aug 28, 2022 in Database by Kithuzzz
• 38,000 points
934 views
0 votes
0 answers

How to DROP multiple columns with a single ALTER TABLE statement in SQL Server?

In one ALTER TABLE statement, I would ...READ MORE

Sep 2, 2022 in Database by Kithuzzz
• 38,000 points
950 views
0 votes
2 answers

Write a SQL query to find the names of employees that begin with ‘S’

Select ename From emp Where ename like"s%"; READ MORE

answered Oct 7, 2021 in Database by anonymous
27,796 views
0 votes
1 answer

How to display the queries executed by a particular user in MySQL?

From the version 5.1.7 onward, MySQL allows ...READ MORE

answered Mar 7, 2019 in Database by Mishti
• 480 points
4,664 views
0 votes
2 answers

How to select the nth row in a SQL database table?

SELECT * FROM ( SELECT ID, NAME, ROW_NUMBER() ...READ MORE

answered Apr 23, 2020 in Database by anand
• 140 points
27,047 views
0 votes
1 answer

Which query to use for better performance, join in SQL or using Dataset API?

DataFrames and SparkSQL performed almost about the ...READ MORE

answered Apr 19, 2018 in Apache Spark by kurt_cobain
• 9,350 points
2,087 views
0 votes
1 answer

How to connect Java program to the MySQL database?

You can connect your Java code with ...READ MORE

answered May 11, 2018 in Java by Parth
• 4,640 points
2,051 views
0 votes
1 answer
0 votes
1 answer

Automating Oracle script with nolio

Depending upon the details of your script ...READ MORE

answered Jul 17, 2018 in Other DevOps Questions by ajs3033
• 7,300 points
1,236 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP