官术网_书友最值得收藏!

Schema usages

Schemas are used for the following reasons:

  • Control authorization: In a multi-user database environment, you can use schemas to group objects based on roles.
  • Organize database objects: You can organize the database objects in groups based on business logic. For example, historical and auditing data could be logically grouped and organized in a specific schema.
  • Maintain third-party SQL code: The extensions available in the contribution package can be used with several applications. Maintaining these extensions in separate schemas enables the developer to reuse these extensions and to update them easily.

In the car web portal, let's assume that we would like to create a schema named car_portal_app, owned by the car_portal_app role. This can be done as follows:

CREATE SCHEMA car_portal_app AUTHORIZATION car_portal_app;

The schema owner is the same as the schema name, if not provided:

CREATE SCHEMA AUTHORIZATION car_portal_app;

For more information about the syntax of the CREATE SCHEMA command, you can use the psql \h meta-command, which displays the psql client tool's inline help, or take a look at the PostgreSQL manual at http://www.postgresql.org/docs/current/static/sql-createschema.html.

主站蜘蛛池模板: 南华县| 西华县| 高台县| 遵化市| 徐州市| 崇明县| 安新县| 吉隆县| 漾濞| 江北区| 日喀则市| 郎溪县| 乌拉特后旗| 东阿县| 尚义县| 宁明县| 奉新县| 正蓝旗| 定边县| 绥棱县| 阳山县| 伊吾县| 修武县| 甘德县| 措美县| 阜宁县| 老河口市| 陇南市| 潞城市| 公安县| 广宁县| 遵义市| 宁强县| 喀喇| 通州市| 龙门县| 电白县| 涪陵区| 常德市| 泽普县| 日喀则市|