schema -> floor plan
database -> house
table -> room
Answer from MusiGenesis on Stack Overflowschema -> floor plan
database -> house
table -> room
A relation schema is the logical definition of a table - it defines what the name of the table is, and what the name and type of each column is. It's like a plan or a blueprint. A database schema is the collection of relation schemas for a whole database.
A table is a structure with a bunch of rows (aka "tuples"), each of which has the attributes defined by the schema. Tables might also have indexes on them to aid in looking up values on certain columns.
A database is, formally, any collection of data. In this context, the database would be a collection of tables. A DBMS (Database Management System) is the software (like MySQL, SQL Server, Oracle, etc) that manages and runs a database.
Can someone help me understand schemas and how they relate to databases?
Database or schema? [newbie]
What is the difference between a table and a schema?
ELI5 the function and differences between schema, views and tables.
I've been using PostgreSQL for over 15 years and yet I never fully understood the term schema or how namespaces are used. This causes some confusion when reading docs.
I understand the general concept of namespaces but first of all is schema just a word for namespace?
Can existing databases be configured with namespaces, can they use multiple namespaces?
Is this valuable for security if you can configure users to have access to the databases in a certain namespace without giving them access to databases?
I work as a web developer and have experience with both Oracle and SQL Server but I've started to look into PostgreSQL, to begin with for personal projects but I'll hopefully be able to move the company at least partially over from Oracle to PostgreSQL in the future.
I've set up a dedicated machine running PostgreSQL and so far I'm really liking what I'm seeing and reading. My only stumble block so far is more of a question of best practice and is basically when to use databases and when to use schemas. As far as I can tell they can both be used to solve many of the same task, i.e. setting a tablespace and namespacing objects. The only difference I've seen so far is that roles are separate between databases. So how do you choose when to create a new database and when to just use a new schema?
For my personal projects I'm leaning towards just using schemas since I'd prefer to have roles be able to access multiple schemas. Is there any good reasons to instead use databases?
Oh, and does the default database "postgres" have any special meaning(like the template databases), or should I just create my schemas in it and not bother creating a new database?