mdmartiny Posted November 30, 2012 Share Posted November 30, 2012 I have a database that has many tables in it. I would like to do a search of all of the databases. I am unsure on how I would do this. Anyone know a way or point me in the right direction. I am looking to search the tables by date and post the top 10 results. Quote Link to comment Share on other sites More sharing options...
requinix Posted November 30, 2012 Share Posted November 30, 2012 It's really unusual to search all the tables in the database. Surely you want to search a specific subset of tables? Quote Link to comment Share on other sites More sharing options...
mdmartiny Posted November 30, 2012 Author Share Posted November 30, 2012 I don't really want to search all of the tables. There are going to be some like users, categories and sub categories. The ones that I want to search are going to be the ones that users post their items they are selling in. Which will be a lot I am not sure how many different sub categories that I am going to have I am still working on them. Quote Link to comment Share on other sites More sharing options...
mdmartiny Posted November 30, 2012 Author Share Posted November 30, 2012 Or actually would it be better to have all ads in one table. So I would have these as tables -users -category -sub category -ads Then I could use the Ids from category and sub category as foreign keys in the ads table. That way I only have to search one table instead of like 50 or however many I end up with. I think I originally was going to go with this but thought it would be easier to understand if I had a table for every sub category. Quote Link to comment Share on other sites More sharing options...
requinix Posted November 30, 2012 Share Posted November 30, 2012 One table is definitely the way to go. Quote Link to comment Share on other sites More sharing options...
mdmartiny Posted December 2, 2012 Author Share Posted December 2, 2012 The more I think about it. It would be kind of hardtop do one table. Different ads are going to require different information. A ad for a car is not going to use the same information as an ad for a chair. Do you have a suggestion for a different way of me to store the information used in my ads. I am just trying to figure out the best way to do it. I just don't want to make the ads to general. Quote Link to comment Share on other sites More sharing options...
Jessica Posted December 2, 2012 Share Posted December 2, 2012 I'd have one table for ads holding title, user, dates etc. then add details which holds rows of many to one relationship with ads. Quote Link to comment Share on other sites More sharing options...
mdmartiny Posted December 2, 2012 Author Share Posted December 2, 2012 I'd have one table for ads holding title, user, dates etc. then add details which holds rows of many to one relationship with ads. So the general information that all of the ads will contain be in the ads table and then all of the secondary information specific to the particular ad be placed in the details table. Is that correct? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.