Traditional Culture Encyclopedia - Hotel accommodation - The problem of VFP creating permanent links between tables

The problem of VFP creating permanent links between tables

Assumptions: ① The data types and value ranges of the fields with the same name in the four tables are the same; ② If there is no duplicate value or null value in the type number field in the room rate table, the room number field in the room table and the customer number field in the customer table, then:

1. House price table: the main index (primary key) is established for the type number field, and ordinary indexes are established for other fields;

2. Room table: the main index (primary key) is established for the room number field, and ordinary indexes are established for other fields; Establish a one-to-many relationship between the type number fields of the house price table and the room table (that is, the type number of the house price table is the primary key and the type number of the room table is the foreign key).

3. Customer table: the main index (primary key) is established for the customer number field, and ordinary indexes are established for other fields;

4. Sign-in Form: All fields are indexed; Establish a one-to-many relationship between the room number field of the room table and the check-in table (that is, the room number of the room table is the primary key and the room number of the check-in table is the foreign key); Establish a one-to-many relationship between the customer number field in the customer table and the registration form (that is, the customer number in the customer table is the primary key and the customer number in the registration form is the foreign key).

Create Database _ Hotel Library

CREATE TABLE _ house price table (type number C(4) is not an empty primary key, type name C(20), price Y)

Create table _ room table (room number C(4) is not an empty primary key, and type number C(4) refers to _ room rate table)

Create table _ customer table (customer number C(6) is not empty primary key, ID card C( 18), name C(8), gender C(4), work unit C(50) and city C(20)).

Create table _ check-in table (room number C(4) refers to _ room table, customer number C(4) refers to _ customer table, check-in date T, check-out date T)