0 like 0 dislike
1 view
asked ago in Computer Science by (383k points)
How a relation is formed in database?

1 Answer

0 like 0 dislike
answered ago by (383k points)
A relation, or table, in a relational database has certain properties. First off, its name must be unique in the database, i.e. a database cannot contain multiple tables of the same name. Next, each relation must have a set of columns or attributes, and it must have a set of rows to contain the data. As with the table names, no attributes can have the same name.

Next, no tuple (or row) can be a duplicate. In practice, a database might actually contain duplicate rows, but there should be practices in place to avoid this, such as the use of unique primary keys (next up).

Given that a tuple cannot be a duplicate, it follows that a relation must contain at least one attribute (or column) that identifies each tuple (or row) uniquely. This is usually the primary key. This primary key cannot be duplicated. This means that no tuple can have the same unique, primary key. The key cannot have a NULL value, which simply means that the value must be known.

Further, each cell, or field, must contain a single value. For example, you cannot enter something like "Tom Smith" and expect the database to understand that you have a first and last name; rather, the database will understand that the value of that cell is exactly what has been entered.

Finally, all attributes—or columns—must be of the same domain, meaning that they must have the same data type. You cannot mix a string and a number in a single cell.

All these properties, or constraints, serve to ensure data integrity, important to maintain the accuracy of data.
Welcome to Free Homework Help, where you can ask questions and receive answers from other members of the community. Anybody can ask a question. Anybody can answer. The best answers are voted up and rise to the top. Join them; it only takes a minute:

8.6k questions

7.7k answers

24 comments

3.2k users

Categories

Free Hit Counters
...