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