# How should i organize mysql db and tables in this case?

**URL:** <https://forum.kirupa.com/t/how-should-i-organize-mysql-db-and-tables-in-this-case/64612>\
**Category:** Uncategorized\
**Created:** [September 17, 2004, 11:13pm UTC](https://forum.kirupa.com/t/how-should-i-organize-mysql-db-and-tables-in-this-case/64612 "2004-09-17T23:13:57Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![alapimba](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@alapimba](https://forum.kirupa.com/u/alapimba)\
**Post date:** [September 17, 2004, 11:13pm UTC](https://forum.kirupa.com/t/how-should-i-organize-mysql-db-and-tables-in-this-case/64612/1 "2004-09-17T23:13:57Z")

</div>

hello,  
i’m making a site like this: [www.iusedtobelieve.com](http://www.iusedtobelieve.com/) but i’m not sure how to make my database.

i was thinking in make a table with “id” “title” “text” “author” and “visible”(to change between visible or temporary hide, while i don’t accept the submission)  
but i guess this will give me many problems to put all titles together in the same table when i have many entrys.  
so i thought i should make a table for each title… but then i don’t know how to query the db for the latest 10 entrys don’t matter which title it was.  
maybe i should not organize my tables this way… this was how i imagine it.  
can someone help me a bit with this?  
if were you how you would make a site where the structure will be the same that the one i mentioned before but with a different subject.

Thanks in advance for any advices and help.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2004, 4:08am UTC](https://forum.kirupa.com/t/how-should-i-organize-mysql-db-and-tables-in-this-case/64612/2 "2004-09-18T04:08:57Z")

</div>

you need  
id, title, text, author, submissiondate, isvisible, rating

> but i guess this will give me many problems to put all titles together in the same table when i have many entrys.

i dont understand that.

> but then i don’t know how to query the db for the latest 10 entrys don’t matter which title it was.

just query last ten according to submissiondate

cheers

amit

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2004, 10:14am UTC](https://forum.kirupa.com/t/how-should-i-organize-mysql-db-and-tables-in-this-case/64612/3 "2004-09-18T10:14:12Z")

</div>

wont be better to put each theme in a diferent table? i mean… if i create only one table after a few time i’ll have a lot of entries and maybe will be slower to make queries… i was asking if dividing the themes in diferent tables wont be better and more organized.

in case that i create a table for each theme how can i query the db for the latest dates comparing all dates from all tables?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2004, 12:29pm UTC](https://forum.kirupa.com/t/how-should-i-organize-mysql-db-and-tables-in-this-case/64612/4 "2004-09-18T12:29:31Z")

</div>

No, it won’t be slower. It’ll be faster.

If it becomes too slow, then you can create an index on the table that’s suited to the way you access the table and then it’ll be fast again. But you’ll need a _lot_ of entries before that’s an issue.

I have a (MySQL) table with over 170,000 entries and that’s still fast enough that I haven’t bothered with an index on it.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2004, 12:32pm UTC](https://forum.kirupa.com/t/how-should-i-organize-mysql-db-and-tables-in-this-case/64612/5 "2004-09-18T12:32:26Z")

</div>

ah cool 🙂  
so i’ll make only one table

can i ask what you have in your db with 170,000 entries? 😑  
just curiosity… eheh

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 20, 2004, 8:43am UTC](https://forum.kirupa.com/t/how-should-i-organize-mysql-db-and-tables-in-this-case/64612/6 "2004-09-20T08:43:36Z")

</div>

databases are built to handle millions of records. so dont worry on number of records.

just use indexes properly

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 20, 2004, 10:32am UTC](https://forum.kirupa.com/t/how-should-i-organize-mysql-db-and-tables-in-this-case/64612/7 "2004-09-20T10:32:26Z")

</div>

Wouldn’t it be better for him to have a seperate Authors table? that way he could store other things about the author like their e-mail address, web address, and maybe a short bio… he could then have the authors name link to the authors page to display the information on the given author.

Of course this wouldn’t be neccessary if the author isn’t important, just an idea :thumb:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 20, 2004, 10:36am UTC](https://forum.kirupa.com/t/how-should-i-organize-mysql-db-and-tables-in-this-case/64612/8 "2004-09-20T10:36:21Z")

</div>

hi

that would be cool but would be less ppl posting stuff cause it was a lot of work… register and stuff… i don’t want to scare the visitants 🙂  
this way it’s better because anyone can go there post and left.  
i thought about asking mail to let ppl know that his posts has been inserted and keep the e-mail hidden but i haven’t decided yet if i’ll do it or not 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 20, 2004, 6:33pm UTC](https://forum.kirupa.com/t/how-should-i-organize-mysql-db-and-tables-in-this-case/64612/9 "2004-09-20T18:33:19Z")

</div>

Well, for maximum expandability then I would suggest making a seperate authors table. The information wouldn’t have to be required anyway, they could just enter their website or whatever if they wanted to.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 21, 2004, 4:42am UTC](https://forum.kirupa.com/t/how-should-i-organize-mysql-db-and-tables-in-this-case/64612/10 "2004-09-21T04:42:55Z")

</div>

i does make sense but only if you are anticipating repeated postings by same person.

so like APDesign said, let user post freely and give him an option to register.  
then maintain top users by postings, public ratings, expert ratings etc as an incentive to register.
