Jump to content

Need advice in making databases


subhomoy

Recommended Posts

Hello everyone,

 

I'm going to create my school project and I really need your advice.

 

My Project Summary 

 

I need to create a new website where the user can add new schools in my site. After creating, they can add students, add teachers, add principal and hell lot of things from their admin panel. And in the frontend they will get their own urls and can display their schools.

 

Ex1: example.com/st_sebastians/  <------- School name.

Ex2: example.com/st_augustin/  <------- School name.

 

When the user will visit those url they will see all the contents of their respective schools.

 

My Questions

 

How can I create those database. For that I've thought of two methods.

 

1) I will create multiple database for every user/school dynamically using php and saves the record in it.

(I searched on google that it is very prone to mysql injection.)

 

2) I will create a single database with everything related to their (school id) and stores in the single database.

 

Example Student table

 

id | school_id | name | roll |

----------------------------------------------

1  |    1             | Subho | 123456

----------------------------------------------

2  |    5             | xyz      |  236566

----------------------------------------------

3  |   45            | asfgf    | 778219

 

.

.

.

.

.

.

.

.

 

Please note that the database are going to store whole lot of records and I don't want to it slow down.

 

Any Help will be highly appreciated.

Thank You In advance...

Link to post
Share on other sites

You should definitely have a single database for the entire application. Creating a new database for every school is a bad idea. Not only is it insecure, it's also a huge problem for backups and updates, because you'd have to repeat everything for each database.

 

 

 

Please note that the database are going to store whole lot of records and I don't want to it slow down.

 

MySQL was designed to handle hundreds of millions of rows. I'm fairly sure your school project needs a lot less than that.

Link to post
Share on other sites

Thanks you @Jacques1, for the help.... Yeah  definitely school projects doesn't need lots of space though.... :P 

Can you plz throw light on some indexing method which will help me in long run for my project...

 

 

Thank you  once again...

Link to post
Share on other sites

[Moving to MySQL Forum]

 

There is no indexing 'method', but there are best practices. There are many different considerations when determining what to index and I am by no means a DBA. I would suggest reading up on the subject. There are also ways to analyze queries to determine where indexes may be needed. Here are a few resources that may be of help.

 

http://dev.mysql.com/doc/refman/5.7/en/mysql-indexes.html

https://dev.mysql.com/doc/refman/5.7/en/using-explain.html

http://www.databasejournal.com/features/mysql/article.php/3840606/Maximizing-Query-Performance-through-Column-Indexing-in-MySQL.htm

http://www.slideshare.net/matsunobu/more-mastering-the-art-of-indexing

Link to post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.