USE “schema_name” in PostgreSQL

http://timmurphy.org/tag/mysql/

http://timmurphy.org/2009/11/17/use-schema_name-in-postgresql/

 ====================================

For those moving from MySQL to PostgreSQL, there are a few differences which you will need to get used to.  One of these differences is the USE command, used to select the schema to select tables, views, etc from.

PostgreSQL does not have the USE command.  Instead, you can use:

SET search_path TO [schema_name]

For example, if we have a schema mySchema in which we are querying the person table, instead of SELECT * FROM mySchema.person, we can simply type SET search_path TO mySchema and use SELECT * FROM person for all subsequent queries.  mySchema will remain the default schema until the next SET command is issued, or the connection is closed.

转载于:https://www.cnblogs.com/kungfupanda/p/5503862.html

猜你喜欢

转载自blog.csdn.net/weixin_34220179/article/details/94493637
今日推荐