How To Create Relational Databases

Table of contents:

How To Create Relational Databases
How To Create Relational Databases

Video: How To Create Relational Databases

Video: How To Create Relational Databases
Video: Creating a Relational Database 2024, December
Anonim

The relational approach to building databases implies working with a tabular data model, that is, with the usual way of presentation. It is implemented using database management systems.

How to create relational databases
How to create relational databases

Essence of a relational structure and data preparation

Each database is organized and structured information stored in one or more tables. Tables are a natural and familiar view of data, consisting of rows and columns. The relational approach implies a certain relationship between such tables. Links or relationships allow you to combine, retrieve data from several tables at once in one query.

In order to create a relational database, it is necessary, first of all, to form a set of tables and relations between them. In this case, you must follow the following rules. First, each table must be of the same type and have a unique name. Second, the rows of the table must consist of a fixed number of fields and values (you cannot include multiple columns and repeating groups). Third, the strings must be at least one value (field) different from each other in order to be able to identify any string. Fourth, the columns must have unique names and be filled with homogeneous data values, the only possible method of presentation is the explicit data value (there can be no special relationships between tables).

You can process data from multiple tables at once by merging selections into a temporary table. The most common operations are selection, projection, natural join, union, intersection, and difference. When forming tables, one of the basic concepts is the primary key - it is an identifier that unambiguously refers to an entity. For example, in a table of dishes, the primary key could be the dish number. For all tables with data, you need to create similar keys, linking them with relationships.

Implementation using a DBMS

Database management systems (Oracle, MySQL, SQLite, etc.) provide complete management of generated data and allow you to execute queries. Having chosen one of the DBMS, you must transfer the created tables to the program according to its syntax. This is a voluminous work that needs to be done carefully without missing out on important attributes.

Further work with queries and data processing is based on the SQL programming language. It is in this language that tables are created, records are added, deleted and changed, data is fetched from one or more tables, and the structure is changed.

Recommended: