0

Wanted to select range of records based on initial characters of the employee name?

String initialChar=sc.next()+"%"; What is this% do there???

21st May 2020, 2:22 PM
Piyush Srivastava
Piyush Srivastava - avatar
2 Answers
+ 3
The '%' character just ignores whatever is in there. For example if you want to look for a name which starts with 'p' from the employee table then you must say- Select name from employee where name like "p%";
21st May 2020, 4:10 PM
Avinesh
Avinesh - avatar
+ 1
% Represents zero or more characters bl% finds bl, black, blue, and blob https://www.w3schools.com/sql/sql_wildcards.asp
22nd May 2020, 5:24 AM
zemiak