当前位置: 动力学知识库 > 问答 > 编程问答 >

mysql - How do I to add multiple directories to an SQL database while sharing the same schema?

问题描述:

A buddy of mine needed help adding multiple directories to an SQL database while sharing the same schema yet have different listings. I've scoured my "MySQL" books and Google, I can't find any definitive information. I was just hoping someone here knew how to do this.

To clarify, there are a total of 12 directories. 11 are to be searched independently of one another and the 12th (which already exists) will be a directory comprised of all 11 directories, all of which will have the same schema.

The goals are to create these unique directories using the existing schema model, and to upload multiple directory entries at a time to the directories.

Does this mean the names of the directory entries have to be unique (ie. Name_1, Name_2, Name_3, etc...?) Or, will it be a matter of duplicating the schema under a different name? Any advise will help.

A directory, in this context, is like a roledex. I mean to have 12 roledexes with each rolodex having unique entries frem eachother. How do you approach this database-wise?

网友答案:

After logging into your PHPMyadmin select or go in to the table you want to duplicate-and-rename, then click on "Operations." There you see a series of boxes with one called "Copy table to (database.table)" You can choose to duplicate structure and data, or structure only. Type the name you want and click go. And your new table with listing will be ready to edit and search!

网友答案:

If I understand what you're asking... I think you want to create a new database for each "directory," as you put it, with the same table definitions in it.

The word "database" in mySQL parlance means the same thing as "schema" in the parlance of some other RDBMS systems. You can't have two sets of data with the same table names in the same database (a/k/a schema). You need a different schema for this.

It's very common to have lots of databases in a single server with precisely the same tables / columns / keys etc. And yes, phpmyadmin can handle this.

The word "directory" is confusing, though. It ordinarily refers to the on-disk data storage used by the mySQL (RDBMS) server program. But I don't think that's what you mean. If you DO mean it, please make sure you are highly skilled at system administration before you try to muck around with the file systems on the mySQL server. It's easy to break stuff. (Ask me how I know how easy it is to break stuff :-) :-)

分享给朋友:
您可能感兴趣的文章:
随机阅读: