{"id":3519,"date":"2022-09-05T18:15:37","date_gmt":"2022-09-05T18:15:37","guid":{"rendered":"https:\/\/databasetown.com\/?p=3519"},"modified":"2023-01-15T21:00:15","modified_gmt":"2023-01-15T21:00:15","slug":"relational-database-model-operations-constraints","status":"publish","type":"post","link":"https:\/\/databasetown.com\/relational-database-model-operations-constraints\/","title":{"rendered":"Relational Database (Model, Operations & Constraints)"},"content":{"rendered":"\n

Relational databases are used for storing and organizing data in a way that can be easily accessed, updated, and queried. They consist of tables. A table is a set of data values that are organized in columns and rows. The cells are where the rows and columns intersect.<\/p>\n\n\n\n

Relational Model<\/h2>\n\n\n\n

The relational model is a data model for storing and retrieving information. It is the most widely used database model in the world, with over 90% of commercial databases using it. The term “relational” refers to how data in tables are related to one another through common field names and similar rows structure. Relational databases are made up of relations that consist of columns<\/strong> (or attributes) and rows<\/strong> (also called tuples or records). <\/p>\n\n\n\n

In the relational database model, each piece of data is stored in a row (or record) and columns (or fields). Each row is linked to other rows via unique IDs. This eliminates duplication of data. The database performs automatic work here: if the ID changes at any time (e.g., due to updating), then the link will be updated accordingly.<\/p>\n\n\n\n

ID<\/strong><\/td>Product Name<\/strong><\/td>Weight (g)<\/strong><\/td>Pack<\/strong><\/td><\/tr>
701<\/td>Honey<\/td>500<\/td>12<\/td><\/tr>
702<\/td>Honey<\/td>1000<\/td>6<\/td><\/tr>
703<\/td>Lentils<\/td>250<\/td>4<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n
\"table<\/figure>\n\n\n\n

Terminologies Used in Relational Model<\/h3>\n\n\n\n
    \n
  1. Tables<\/strong> – The relational model uses the table format to save relationships. Each table has two properties: rows and columns. Rows represent records, while columns represent attributes.<\/li>\n\n\n\n
  2. Tuple<\/strong> – A single row in a table contains the record and is called tuple.<\/li>\n\n\n\n
  3. Cardinality: <\/strong>Number of rows (tuples) of the table is called cardinality.<\/li>\n\n\n\n
  4. Attribute<\/strong> – A column in the table is called attribute. These are the properties define relation.<\/li>\n\n\n\n
  5. Degree:<\/strong> Number of attributes in the table is called degree.<\/span><\/li>\n\n\n\n
  6. Relation Schema:<\/strong> A relation schema represents the name, attributes and cardinality of a single relationship between two or more entities.<\/li>\n\n\n\n
  7. Relation instance<\/strong> \u2013 Relation instance is a finite set of tuples in the RDBMS system. Relation instances never have duplicate tuples.<\/li>\n\n\n\n
  8. Relation key<\/strong> \u2013 Every row has one, two or multiple attributes, which is called relation key.<\/li>\n\n\n\n
  9. Attribute domain<\/strong> \u2013 Every attribute has some pre-defined value and scope which is known as attribute domain.<\/li>\n<\/ol>\n\n\n\n

    Integrity Constraints<\/h3>\n\n\n\n

    The basic structure consists of:<\/p>\n\n\n\n