Relational vs. Non-Relational Databases: Concepts & Examples
-
Relational databases are structured and organized using tables with predefined relationships between them. Non-relational databases, on the other hand, are unstructured and do not have a predefined schema. Relational databases follow a fixed schema, while non-relational databases are flexible and scalable. Examples of relational databases include MySQL, Oracle, and SQL Server. Examples of non-relational databases include MongoDB, Cassandra, and Couchbase.
-
Tables: A collection of related data that is organized in rows and columns. Views: A virtual table that is based on the result of a SQL query. Row: A horizontal entity in a table that represents a single record. Record: A set of related data that is stored in a table. Column: A vertical entity in a table that represents a data attribute. Field: A single data element within a record. Primary key: A unique identifier for a record in a table. Foreign key: A key that links two tables together. Join: A SQL operation that combines rows from two or more tables based on a related column between them.
-
One-to-one relationship: A relationship where each record in one table is associated with only one record in another table. For example, a person can have only one passport number, and a passport number can be assigned to only one person. One-to-many relationship: A relationship where each record in one table can be associated with many records in another table, but each record in the other table can be associated with only one record in the first table. For example, a customer can have many orders, but each order is associated with only one customer. Many-to-many relationship: A relationship where each record in one table can be associated with many records in another table, and vice versa. For example, a student can enroll in many courses, and each course can have many students. This relationship requires a junction table to link the two tables together.
原文地址: https://www.cveoy.top/t/topic/oRdd 著作权归作者所有。请勿转载和采集!