开发者

MySql: does it have namespace-like SCHEMA?

开发者 https://www.devze.com 2022-12-20 18:20 出处:网络
I hav开发者_StackOverflowe to move a database from sql server to mySql, and our current db uses schemas as namespace.

I hav开发者_StackOverflowe to move a database from sql server to mySql, and our current db uses schemas as namespace.

So all of the FOO tables can be reference like FOO.TableFoo1, FOO.TAbleFoo2, FOO.TableF003, etc.

Can we do this with MySql? Will it work.


That is wrong Joachim. A database is not a schema. Try buying hosting where you only get 20 databases but you need 33. With a schema you can use only one database and have many tables with the same name but different schema.


Yes in mysql you can have many schema, select the schema you want to use with the USE command or the mysql_select_db() API. You can also do cross-schema queries, as in

SELECT * FROM `FOO`.`TABLEFOO1`, `BAR`.`TABLEBAR1` WHERE ...

You create and delete schema using CREATE DATABASE FOO and DROP DATABASE BAR.

0

精彩评论

暂无评论...
验证码 换一张
取 消