Cách tạo CSDL và các ràng buộc #đ22ht_qtcsdl_chieu3_baitapnhom #đ22ht1_qtcsdl_chieu3

Phạm Hồng Nhi
8 followers
The following is an introduction to the types of data bindings in SQL Server.
The first is the primary key key.
Here they create a student list, including a number of students and their names.
Here, the students play the main role,
We help to uniquely identify each student.
For the primary key on many columns,
Then here you will create a form, for example you will create a school registration form,
Including number of students, number of classes and registration dates.
Here, students and classmates all play key roles,
That means a student can't register for the same class multiple times.
The second is a foreign key.
Here are the students, including the students,
This is the main lock, closed to students and classrooms.
The class defined here is the external key.
And refer to the classroom plan.
That means there's a class of students.
must exist in the classroom.
What a unique bond.
The value is unique and not identical.
Create a student with a student as the main key,
Their email and age.
Email is unique,
So each student has only one email and it doesn't match.
The fourth is the compulsory check of the data conditions.
The students' union is the main one.
Their name and age.
At this age, it is mandatory to check the age of majority at 18,
which means only accepting ages 18 and up,
If you are under 18 years of age, you will be informed that the data is not valid.
Following the default, value is set.
Here's the product,
The product code is the main key,
name and quantity of the product.
Number of units of the default,
That means if mà không có nhập giá trị nào vô trong đây.
Then its default value will be 0,
And the number will be 0 if it doesn't enter.
That last one is bound not null,
It's not worth it.
