- 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.
推薦閱讀
- Progressive Web Apps with React
- Getting Started with ResearchKit
- Ext JS Data-driven Application Design
- Python Deep Learning
- 自制編程語言
- C語言程序設計
- 智能手機APP UI設計與應用任務教程
- Instant PHP Web Scraping
- 軟件體系結(jié)構(gòu)
- 零代碼實戰(zhàn):企業(yè)級應用搭建與案例詳解
- 區(qū)塊鏈國產(chǎn)化實踐指南:基于Fabric 2.0
- C指針原理揭秘:基于底層實現(xiàn)機制
- Learning NHibernate 4
- HTML5/CSS3/JavaScript技術(shù)大全
- iOS應用逆向工程:分析與實戰(zhàn)