ASP (C #) Tourist Attractions Online voting (i)

Source: Internet
Author: User

Database:
1 Create DatabaseTourvote;2 Create TableVotetheme3 (4ThemeidChar(Ten)Primary Key,5ThemeChar( +),6Votesumint 7 )8 Create TableTourism9 (TenTouridChar(Ten)Primary Key, OneTournameChar( -), AIntroductiontext , - Image Char( -), - ) the Create TableVoteresult - ( -ThemeidChar(Ten), -TouridChar(Ten), +Votenumint, -Voterateint, + Primary Key(Themeid,tourid), A Foreign Key(Themeid)ReferencesVotetheme (Themeid), at Foreign Key(Tourid)ReferencesTourism (tourid), - ) - Create TableAdmin - ( -IdChar(Ten)Primary Key, -NameChar(Ten), inPwdChar(Ten) -)

ALTER TABLE Voteresult
Add constraint
Votenum
Default 0 for Votenum;

Add constraint:

In the Voteresult

Check (Tourid in select Tourid from tourism)

Check (Themeid in select Themeid from Votetheme)

Foreign KEY (Themeid) references votetheme (themeid) on Delete on update
Foreign KEY (Tourid) references
1. Cascade, cascade operation. The primary table data is updated (the primary key value is updated), and the table is updated (foreign key value updates). The primary table record is deleted and the related records from the table are also deleted.
2. Set NULL, setting to NULL. The primary table data is updated (the primary key value is updated), and the foreign key from the table is set to NULL. The primary table record is deleted, and the foreign key from the table-related record is set to NULL. Note, however, that the foreign key column is required and there is no not NULL property constraint.
3. Restrict, reject parent table deletion and update.


ASP (C #) Tourist Attractions Online voting (i)

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.