Is it possible to search all tables in a Mysql database?
Question:
I would like to ask if it is possible to search MySQL database which contains about 12 tables
in one query, because I want to use "LIMIT 0,30" for paging because the returned result would be large.
I tried writing the following but I didn't give me any results.
SELECT scholarship.serialNum, scholarship.category, scholarship.description, acceptnums.serialNum,
acceptnums.category, acceptnums.description, conference.serialNum, conference.category,
conference.description, occupancy.serialNum, occupancy.category, occupancy.description,
hiring.serialNum.....
FROM scholarship, acceptnums,transRules, conference, occupancy, hiring.........
WHERE scholarship.description LIKE '%sara%' OR scholarship.decision LIKE '%sara%'
OR scholarship.name LIKE '%sara%' OR acceptnums.description LIKE '%sara%'
OR acceptnums.decision LIKE '%sara%' OR acceptnums.nums LIKE '%sara%'
OR conference.description .......
Answer:
It is possible that you have just asked too much.
It is more likely you have made a little syntactic mistake or semantic mistake.
...however to make a query like that then there must be a bit of a design problem in your database.
If you really need to check all tables then you could break the query down into a dozen smaller queries which could actually be more efficient. You can still collect the data and do with it as you please.
More Questions & Answers...