Schema
Schema :- A PostgreSQL database cluster contains one or more named databases.
- A database contains one or more named schemas, which in turn contain tables.
- The same object name can be used in different schemas without conflict;
- A user can access objects in any of the schemas in the database he is connected to, if he has privileges to do so.
Why Schemas :- There are several reasons why one might want to use schemas :
– To allow many users to use one database without interfering with each other.
– To organize database objects into logical groups to make them more manageable.
– Third-party applications can be put into separate schemas so they cannot collide with the names of other objects.
Creating a Schema :- To create a schema, use the CREATE SCHEMA command.
- Give the schema a name preferably same as the user name so that it gets associated
automatically. - For example: CREATE SCHEMA training;
- Objects in this schema can be referred using schema.table for e.g training.students.

No comments:
Post a Comment