Pages Navigation Menu

Coding is much easier than you think

Query to properly check if a record exists

Query to properly check if a record exists

 

1) select 1 from table where key = value;

2) select count(1) from table where key = value;

The first alternative should give you no result or one result, the second count should be zero or one.

About Mohaideen Jamil


I'm a Full stack developer of IT exp in J2EE, AngularJs, MicroServices, Docker, Spring (Boot, MVC, Cloud), Bluemix, DevOps. Follow me on Facebook or Google Plus. If you like my tutorials, consider making a donation to this charity, thanks.

Advertisements
%d bloggers like this: