Components of a Relation Schema
- Relation Name: Name of the table that is stored in the database. It should be unique and related to the data that is stored in the table. For example- The name of the table can be Employee store the data of the employee.
- Attributes Name: Attributes specify the name of each column within the table. Each attribute has a specific data type.
- Domains: The set of possible values for each attribute. It specifies the type of data that can be stored in each column or attribute, such as integer, string, or date.
- Primary Key: The primary key is the key that uniquely identifies each tuple. It should be unique and not be null.
- Foreign Key: The foreign key is the key that is used to connect two tables. It refers to the primary key of another table.
- Constraints: Rules that ensure the integrity and validity of the data. Common constraints include NOT NULL, UNIQUE, CHECK, and DEFAULT.
Relation Schema in DBMS
Relation schema defines the design and structure of the relation or table in the database. It is the way of representation of relation states in such a way that every relation database state fulfills the integrity constraints set (Like Primary key, Foreign Key, Not null, Unique constraints) on a relational schema.
It consists of the relation name, set of attributes/field names/column names. every attribute would have an associated domain. In this article, we will discuss relational schema in detail along with proper examples.