- Learning PostgreSQL 11
- Salahaldin Juba Andrey Volkov
- 180字
- 2021-07-02 13:11:50
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.
推薦閱讀
- JavaScript:Functional Programming for JavaScript Developers
- Cocos2d-x游戲開發:手把手教你Lua語言的編程方法
- 深入淺出Windows API程序設計:編程基礎篇
- 機械工程師Python編程:入門、實戰與進階
- Python高效開發實戰:Django、Tornado、Flask、Twisted(第3版)
- C語言程序設計案例精粹
- SQL Server 2012數據庫管理與開發項目教程
- JavaScript:Moving to ES2015
- Visual C++開發入行真功夫
- Active Directory with PowerShell
- LabVIEW虛擬儀器入門與測控應用100例
- Learning Docker Networking
- Advanced UFT 12 for Test Engineers Cookbook
- Hands-On Robotics Programming with C++
- 大數據時代的企業升級之道(全3冊)