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

0 votes
Hi!!

Can someone tell me how to write the query for the above statement?
Sep 27, 2018 in Database by DataKing99
• 8,250 points
27,740 views
how to get column alies as worker

2 answers to this question.

–1 vote

To display the name of the employees that begin with ‘S’, type in the below command:

SELECT * FROM Table_name WHERE EmpName like 'S%'
answered Sep 27, 2018 by Sahiti
• 6,370 points
Yeah that is cool for the names where only first letter is capital but what to do when there are multiple same characters in the same string. Like in this case:-

CREATE TABLE emp_salary(

    emp_id INT PRIMARY KEY ,

    emp_name VARCHAR(10),

    salary INT ,

    emp_age INT

);

INSERT INTO emp_salary VALUES(1,"Raghu",100000,25);

INSERT INTO emp_salary VALUES(8,"Arnav",100000,25);

INSERT INTO emp_salary VALUES(9,"ascsaAjbsj",100000,25);

INSERT INTO emp_salary VALUES(2,"Rajeev",250000,28);

INSERT INTO emp_salary VALUES(3,"Ranvijay",80000,22);

INSERT INTO emp_salary VALUES(4,"Prince",90000,23);

INSERT INTO emp_salary VALUES(5,"Nikhil",82000,22);

INSERT INTO emp_salary VALUES(6,"DELL",54448,22);

INSERT INTO emp_salary VALUES(7,"OPOPPO",748400,24);

SELECT * FROM emp_salary WHERE emp_name LIKE "A%";

Here it will return both Arnav and ascsaAjbsj. What to do?
0 votes
Select ename
From emp
Where ename like"s%";
answered Oct 7, 2021 by anonymous

Related Questions In Database

0 votes
0 answers

SQL to find the number of distinct values in a column

In a column, I can choose each ...READ MORE

Aug 15, 2022 in Database by Kithuzzz
• 38,000 points
1,084 views
0 votes
1 answer

How to drop all tables from a database with one SQL query?

Use the INFORMATION_SCHEMA.TABLES view to get the ...READ MORE

answered Feb 4, 2022 in Database by Neha
• 9,020 points
9,169 views
0 votes
1 answer

Which SQL query is used to find Nth highest salary from a salary table

If you want to find nth Salary ...READ MORE

answered Feb 14, 2022 in Database by Vaani
• 7,070 points
3,096 views
0 votes
0 answers

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

I want to display the names of ...READ MORE

Aug 12, 2022 in Database by Kithuzzz
• 38,000 points
1,032 views
0 votes
0 answers

How to find sum of multiple columns in a table in SQL Server 2005?

I have a table Emp which has these rows: Emp_cd ...READ MORE

Aug 19, 2022 in Database by Kithuzzz
• 38,000 points
1,732 views
0 votes
0 answers

Get all table names of a particular database by SQL query?

I'm developing a program that can interact ...READ MORE

Aug 22, 2022 in Database by Kithuzzz
• 38,000 points
611 views
0 votes
1 answer

What is the SQL query to get the third highest salary of an employee from employee_table

You can try out something like this: SELECT ...READ MORE

answered Sep 27, 2018 in Database by Sahiti
• 6,370 points
13,124 views
0 votes
1 answer

How to find 3rd highest salary in SQL

select max(salary)from employeeposition where salary <(select max(salary)from employeeposition where ...READ MORE

answered Oct 27, 2023 in Database by anonymous

edited Mar 5 53,734 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,036 views
0 votes
1 answer

Is SELECT * harmful in Database?

There are really three major reasons: Inefficiency in ...READ MORE

answered Sep 7, 2018 in Database by DataKing99
• 8,250 points
966 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