2

I don't know if it has another term for it but I want to basically create a directorial database having different databases in one major database and each containing their respective tables. Is there any way to do that in MySQL?

Something like this:

enter image description here

7
  • Please help me I might be wrong in my interpretations since I'm very new to dealing with databases and websites Commented Nov 25, 2015 at 8:11
  • 1
    It's not clear to me what you're trying to achieve, but no, databases inside databases are not possible. Commented Nov 25, 2015 at 8:26
  • could you please just check out that picture and tell me what is that structure called? or how to make it?I mean i just need little guidance to make it Commented Nov 25, 2015 at 8:29
  • 1
    Maybe you should rather describe, what you want to do and why. Commented Nov 25, 2015 at 8:32
  • I have seen this kind of structure and i want to implement the same.I have some DB structures.The main one is exam_db and in that i have to put the other dbs, faculty_db+its tables then ,batch_2015 +its tables etc so on.....just like here in the picture(identical->accessess 6 identical..and so on all in major directory/DB called Access6).so i want to do like this Does that explain? Commented Nov 25, 2015 at 8:40

1 Answer 1

10

No, it is not possible to make a nested database in MySQL.

MySQL supports a simple and flat structure. You cannot nest databases (and of course not tables, nor fields).

If you want to group databases together in MySQL for any reason (like availability), then you can use a common prefix when naming them. For example, if you want to develop an HRM (Human Resource Management System), and it has let's say 3 parts namely: Inventory, Attendance and Leaves, then you can have the following database:

  • HRM_INVENTORY (created by CREATE DATABASE HRM_INVENTORY;)
  • HRM_ATTENDANCE (created by CREATE DATABASE HRM_ATTENDANCE;)
  • HRM_LEAVES (created by CREATE DATABASE HRM_LEAVES;)

Now regarding the image that you have shared in your question, PHPMyAdmin only tries to find common prefixes and group them together to make them easy to find for the user. For example if you create the 3 databases I just mentioned, PHPMyAdmin will group them together under HRM and if you collapse it, you can see all the three.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.