Management learning for SQL Server database tables

Source: Internet
Author: User

1. Data files

The master data file *.mdf has only one

Secondary data files *.ndf have 0-n

Log file *.ldf must have one or more

  

2. Data integrity

Ensuring the integrity of the data is a constraint on the integrity of the data. Reliable + precise.

(1) Column value: The age must be the number, the identity card must be 18;

(2) Entire line requirements: not allowed to repeat, other constraints.

3. Constraints

(1) Entity integrity: Unique constraint, PRIMARY KEY constraint, identity column;

(2) Domain integrity: Check constraints, default values, non-null constraints;

(3) Referential integrity: A column value must be quoted from another table and can be constrained with a foreign key.

(4) Custom integrity: Trigger, check for a value.

(5) Data type:

A. Digital data: Numeric (15,2): Altogether 15 bits, decimal 2 bits. Decimal (18), 18 bits. int, float

B. Character data: varchar (), single byte storage, variable length string, up to 8,000, sacrificing performance, saving space.

char (), fixed length. nvarchar () double-byte storage. Text: Large space.

  

C. Date data type: Datetime,smalldatetime

  

D. Photo type: Image, generally not used, only the database record location.

4. FOREIGN KEY constraints

Right-to-load, from table (foreign key table) to main table (primary key table).

The data in the primary table cannot be deleted until the data in the child table is deleted.

5. Check constraints

Column value right--->check constraint--add keyword (email like '%@% ')

6. Build diagram

Graph right---Select Table--Build diagram--Edit relationship in diagram

Management learning for SQL Server database tables

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.