If I develop a similar healthcare application, there is a search button that finds among "Hospitals, Doctors, Blogs, Specialities, Treatments, Events, Jobs, Testimonials".
I want to know how will this fetch one thing out of all the corresponding tables?
What query will be triggered?
Will it search through all tables one by one?
How would you do this if you had to build such a feature in your application?
It's entirely up to you. The search entry on a webpage is often in a mini-form independent of whatever other form(s) might be on the page - especially when you're talking validating frameworks such as JSF, where a form cannot be accepted if any other value in the form is invalid.
You attach that form to backing logic that takes the data that was entered and searches according to whatever rules you wish. It could be a simple SQL query, a set of queries on multiple tables or a free-form search. In the case of free-form text queries like the forum search feature on the JavaRanch, it's common to use an engine such as Apache Lucene.
An IDE is no substitute for an Intelligent Developer.