subhomoy Posted February 1, 2016 Share Posted February 1, 2016 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... Quote Link to comment Share on other sites More sharing options...
Solution Jacques1 Posted February 1, 2016 Solution Share Posted February 1, 2016 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. Quote Link to comment Share on other sites More sharing options...
subhomoy Posted February 1, 2016 Author Share Posted February 1, 2016 Thanks you @Jacques1, for the help.... Yeah definitely school projects doesn't need lots of space though.... Can you plz throw light on some indexing method which will help me in long run for my project... Thank you once again... Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted February 2, 2016 Share Posted February 2, 2016 Indexing method? What do you mean? Either way, database-specific questions are more suited for the SQL forum. Quote Link to comment Share on other sites More sharing options...
Psycho Posted February 2, 2016 Share Posted February 2, 2016 (edited) [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 Edited February 2, 2016 by Psycho Quote Link to comment Share on other sites More sharing options...
subhomoy Posted February 3, 2016 Author Share Posted February 3, 2016 Thank you everybody... 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.