A schema is a namespace – a logical thing. It is used to organize the names of database objects. It has nothing to do with the way the data is stored.
A tablespace is a physical thing. It’s a container for data and has nothing to do with the logical organization of the database objects.
A single object (e.g. a table) could be spread across multiple tablespaces (depending on the DBMS being used) but it can only be defined in a single schema. The table schema_1.table_1
is a different table than schema_2.table_1
– although the “plain” name is the same, the fully qualified name is different and therefore those are two different tables.
Objects that are organized in the same schema are not necessarily stored in the same tablespace. And a single tablespace can contain objects from different schemas.
Schemas (and catalogs, which are another level of namespace) are part of the SQL language and are defined in the SQL standard.
Tablespaces are part of the physical storage and are DBMS-specific (although nearly all DBMS support a concept like that) and are not part of the SQL query language (as defined by the SQL standard). They are, however, defined and managed through vendor-specific SQL/DDL statements.