• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

SQL: case sensitive matching of records.  RSS feed

 
Ranch Hand
Posts: 626
2
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question: Query the list of STUDENT NAMES starting with vowels (i.e., a, e, i, o, or u) from STUDENT. Your result cannot contain duplicates.
Solution:


Sample input(students name):

output:

My doubt here is: why the OMPAL is matched, even the first character is 'O'(uppercase) and the value in IN clause is 'o'(lowercase).
Shouldn't the query be:
 
Bartender
Posts: 1856
81
Android Chrome IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Case sensitively largely depends on database engine of choice and how it's configured. Sometimes the database engine defers to the operating system.
If you are using MySQL you may want to look at this https://dev.mysql.com/doc/refman/8.0/en/case-sensitivity.html.
Some versions of MySQL the case sensitively can be configured with these lines like this in your MySQL config:

What database engine are you using and what version of that engine are you using?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!