Get the App
SLTechnology News&Howtos  ›  Database  › 

What is the basic concept of SQLServer table

Shulou Source: shulou.com Published: 2022-05-31 12:54:58 10月11日 Update

What is the basic concept of SQL Server table, many novices are not very clear about this, in order to help you solve this problem, the following small series will explain in detail for everyone, there are people who need this can learn, I hope you can gain something.

Basic concepts of SQL Server tables

A table is a database object that contains all the data in the database. Data is organized in tables in a similar way to spreadsheets, organized in rows and columns. Each row represents a unique record, and each row represents a field in the record.

Tables in SQL Server include the following major components:

Columns: Each column represents an attribute of the object modeled by the table. For example, the employee table has number columns, name columns, and title columns;

Rows: Each row represents a separate instance of the object modeled by the table. For example, each employee of the company occupies a row in the table;

data integrity

1) Physical integrity

Entity integrity defines rows as unique entities for a particular table. Entity integrity enforces the integrity of a table's identity column or primary key by UNIQUE index, UNIQUE constraint or PRIMARYKEY constraint;

2) Domain integrity

Domain integrity refers to the validity of items for a particular column. Domain integrity can be enforced by restricting types (by using data types), by restricting formats (by using CHECK constraints and rules), or by restricting the range of possible values (by using FOREIGNKEY constraints, CHECK constraints, DEFAULT definitions, NOT NULL definitions, and rules);

3) Integrity of references

When you enter or delete rows, you reference the relationships defined between integrity preserving tables. When referential integrity is enforced, SQL Server prevents users from:

Add or change rows in related tables when there are no associated rows in the main table;

Change values in the main table (can cause orphaned rows in related tables);

delete rows in the main table if there are matching related rows;

4) User-defined integrity rules

User-defined integrity can define specific business rules that do not belong to any other integrity category. All integrity classes support user-defined integrity, which includes all column-level and table-level constraints, stored procedures, and triggers in CREATE TABLE;

primary key

A primary key uniquely identifies row data in a table. A primary key corresponds to a row of data. A primary key consists of one or more fields, and its value is unique. NULL is not allowed. A table can only have one primary key.

Did reading the above help you? If you still want to have further understanding of related knowledge or read more related articles, please pay attention to the industry information channel, thank you for your support.

Tags: Integrity data representation user rule entity object force restriction concept line employee field situation database identity format category type help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Shulou Technology MariaDB Xiaomi Linux