Смекни!
smekni.com

Автоматизированная система управления комбината Белшина (стр. 13 из 13)

Constraint FK_SupplierContractsignsS FOREIGN KEY (Staff_signsID) References Staff ( RecID ),

Constraint FK_SupplierContractworks_onS FOREIGN KEY (Staff_works_onID) References Staff ( RecID )

);

Alter Table SupplierInvoice Add (

Constraint FK_SupplierInvoiceStaff FOREIGN KEY (StaffID) References Staff ( RecID )

);

Alter Table TimeTable Add (

Constraint FK_TimeTableStaff FOREIGN KEY (StaffID) References Staff ( RecID )

);

Alter Table TransferOrder Add (

Constraint FK_TransferOrderStaff FOREIGN KEY (StaffID) References Staff ( RecID )

);

Alter Table TripCurrency Add (

Constraint FK_TripCurrencyStaff FOREIGN KEY (StaffID) References Staff ( RecID )

);

Alter Table RemainsInShop Add (

Constraint FK_RemainsInShopStock FOREIGN KEY (StockID) References Stock ( RecID )

);

Alter Table Reservation Add (

Constraint FK_ReservationStock FOREIGN KEY (StockID) References Stock ( RecID )

);

Alter Table Addressee Add (

Constraint FK_AddresseeCity FOREIGN KEY (CityID) References City ( RecID ),

CONSTRAINT U_AddresseeU1 UNIQUE ( AddrName, CityID)

);

Alter Table Asessment Add (

Constraint FK_AsessmentStaff FOREIGN KEY (StaffID) References Staff ( RecID )

);

Alter Table Assignment Add (

Constraint FK_AssignmentPart FOREIGN KEY (PartID) References Part ( RecID ),

Constraint FK_AssignmentrecipientTT FOREIGN KEY (TimeTable_recipID) References TimeTable ( RecID ),

Constraint FK_AssignmentTimeTable FOREIGN KEY (TimeTableID) References TimeTable ( RecID ),

Constraint FK_AssignmentPlanAssignItem FOREIGN KEY (PlanAssignItemID) References PlanAssignItem ( RecID )

);

Alter Table CategTarife Add (

Constraint FK_CategTarifeTarife FOREIGN KEY (TarifeID) References Tarife ( RecID )

);

Alter Table CategTarifeLinks Add (

Constraint FK_CategTarifeLinksGP FOREIGN KEY (GroupProffesionID) References GroupProfession ( RecID ),

Constraint FK_CategTarifeLinksCT FOREIGN KEY (CategTarifeID) References CategTarife ( RecID )

);

Alter Table CategTarifItem Add (

Constraint FK_CategTarifItemTarifeItem FOREIGN KEY (TarifeItemID) References TarifeItem ( RecID ),

Constraint FK_CategTarifItemCT FOREIGN KEY (CategTarifeID) References CategTarife ( RecID )

);

Alter Table CContractItem Add (

Constraint FK_CContractItemCC FOREIGN KEY (CustomerContractID) References CustomerContract ( RecID ) ON DELETE CASCADE ,

Constraint FK_CContractItemPriceType FOREIGN KEY (PriceTypeID) References PriceType ( RecID ),

Constraint FK_CContractItemProduct FOREIGN KEY (ProductID) References Product ( RecID ),

Constraint FK_CContractItemDT FOREIGN KEY (DeliveryTypeID) References DeliveryType ( RecID ),

CONSTRAINT U_CContractItemU1 UNIQUE ( ItemNo, CustomerContractID)

);

Alter Table City Add (

Constraint FK_CityDistrict FOREIGN KEY (DistrictID) References District ( RecID ),

CONSTRAINT U_CityU1 UNIQUE ( CName, CityType, DistrictID)

);

Alter Table Coefficient Add (

Constraint FK_CoefficientComputation FOREIGN KEY (ComputationID) References Computation ( RecID )

);

Alter Table Country Add (

Constraint FK_CountryCurrency FOREIGN KEY (CurrencyID) References Currency ( RecID ),

CONSTRAINT U_CountryU1 UNIQUE ( Abbrev),

CONSTRAINT U_CountryCurrencyID UNIQUE ( CurrencyID)

);

Alter Table Covering Add (

Constraint FK_CoveringNeedPlanItem FOREIGN KEY (NeedPlanItemID) References NeedPlanItem ( RecID ),

Constraint FK_CoveringStock FOREIGN KEY (StockID) References Stock ( RecID ),

CONSTRAINT U_CoveringUL UNIQUE ( NeedPlanItemID, StockID)

);

Alter Table DAdepartment Add (

Constraint FK_DAdepartmentAddressee FOREIGN KEY (AddresseeID) References Addressee ( RecID ),

CONSTRAINT U_DAdepartmentAddresseeID UNIQUE ( )

);

Alter Table DateWork Add (

Constraint FK_DateWorkDispetcherStaff FOREIGN KEY (StaffID) References Staff ( RecID ),

Constraint FK_DateWorkOperatorStaff FOREIGN KEY (Staff_1ID) References Staff ( RecID ),

CONSTRAINT U_DateWorkU1 UNIQUE ( WorkDate)

);

Alter Table Department Add (

CONSTRAINT U_DepartmentU1 UNIQUE ( DepCode)

);

Alter Table Diploma Add (

Constraint FK_DiplomaStatusGrade FOREIGN KEY (StatusGradeID) References StatusGrade ( RecID ),

Constraint FK_DiplomaStaff FOREIGN KEY (StaffID) References Staff ( RecID ),

Constraint FK_DiplomaHSGradeShool FOREIGN KEY (HSGradeShoolID) References HSGradeShool ( RecID )

);

Alter Table DirtyWorks Add (

Constraint FK_DirtyWorksPlaceEmpAssoc FOREIGN KEY (PlaceEmpAssocID) References PlaceEmpAssoc ( RecID ),

Constraint FK_DirtyWorksDirtyType FOREIGN KEY (DirtyTypeID) References DirtyType ( RecID ),

Constraint FK_DirtyWorksOrders FOREIGN KEY (OrdersID) References Orders ( RecID )

);

Alter Table Dissmissed Add (

Constraint FK_DissmissedDissmissReason FOREIGN KEY (DissmissReasonID) References DissmissReason ( RecID ),

Constraint FK_DissmissedStaff FOREIGN KEY (StaffID) References Staff ( RecID ),

Constraint FK_DissmissedOrders FOREIGN KEY (OrdersID) References Orders ( RecID ),

CONSTRAINT U_DissmissedStaffID UNIQUE ( StaffID)

);

Alter Table Employee Add (

Constraint FK_EmployeeAddressee FOREIGN KEY (AddresseeID) References Addressee ( RecID ),

CONSTRAINT U_EmployeeU1 UNIQUE ( AddresseeID, FamilyName, FirstName, SecondName)

);

Alter Table GroupProfession Add (

CONSTRAINT U_GroupProfessionU1 UNIQUE ( GroupName)

);

Alter Table InPersonnel Add (

Constraint FK_InPersonnelStaff FOREIGN KEY (StaffID) References Staff ( RecID ),

Constraint FK_InPersonnelPersonStatus FOREIGN KEY (PersonStatusID) References PersonStatus ( RecID ),

CONSTRAINT U_InPersonnelStaffID UNIQUE ( StaffID)

);

Alter Table InquiryOfferAssoc Add (

Constraint FK_InquiryOfferAssocSII FOREIGN KEY (SuppInquiryItemID) References SuppInquiryItem ( RecID ),

Constraint FK_InquiryOfferAssocSOI FOREIGN KEY (SupplierOfferItemID) References SupplierOfferItem ( RecID ),

CONSTRAINT U_InquiryOfferAssocUL UNIQUE ( SuppInquiryItemID, SupplierOfferItemID)

);

Alter Table LostTime Add (

Constraint FK_LostTimeDirtyWorks FOREIGN KEY (DirtyWorksID) References DirtyWorks ( RecID ),

Constraint FK_LostTimeLostTimeType FOREIGN KEY (LostTimeTypeID) References LostTimeType ( RecID )

);

Alter Table Nationality Add (

CONSTRAINT U_NationalityU1 UNIQUE ( NationalCode)

);

Alter Table NonCategTarife Add (

Constraint FK_NonCategTarifeTarife FOREIGN KEY (TarifeID) References Tarife ( RecID )

);

Alter Table NonCategTarifItem Add (

Constraint FK_NonCategTarifItemP FOREIGN KEY (ProfessionID) References Profession ( RecID ),

Constraint FK_NonCategTarifItemTI FOREIGN KEY (TarifeItemID) References TarifeItem ( RecID ),

Constraint FK_NonCategTarifItemNCT FOREIGN KEY (NonCategTarifeID) References NonCategTarife ( RecID )

);

Alter Table Orders Add (

CONSTRAINT U_OrdersU1 UNIQUE ( OrderDate, OrderNumber)

);

Alter Table OrderType Add (

CONSTRAINT U_OrderTypeU1 UNIQUE ( Abbrev)

);

Alter Table OtherTarife Add (

Constraint FK_OtherTarifeTarife FOREIGN KEY (TarifeID) References Tarife ( RecID )

);

Alter Table OtherTarItem Add (

Constraint FK_OtherTarItemStaff FOREIGN KEY (StaffID) References Staff ( RecID ),

Constraint FK_OtherTarItemOtherTarife FOREIGN KEY (OtherTarifeID) References OtherTarife ( RecID )

);

Alter Table OutPersonnel Add (

Constraint FK_OutPersonnelStaff FOREIGN KEY (StaffID) References Staff ( RecID ),

CONSTRAINT U_OutPersonnelStaffID UNIQUE ( StaffID)

);

Alter Table Passes Add (

Constraint FK_PassesCountry FOREIGN KEY (CountryID) References Country ( RecID ),

Constraint FK_PassesStaff FOREIGN KEY (StaffID) References Staff ( RecID )

);

Alter Table Passport Add (

Constraint FK_PassportStaff FOREIGN KEY (StaffID) References Staff ( RecID ),

Constraint FK_PassportDAdepartment FOREIGN KEY (DAdepartmentID) References DAdepartment ( RecID ),

Constraint FK_PassportPassType FOREIGN KEY (PassTypeID) References PassType ( RecID )

);

Alter Table PassType Add (

CONSTRAINT U_PassTypeU1 UNIQUE ( PassTypeName)

);

Alter Table Pensioner Add (

Constraint FK_PensionerPensionType FOREIGN KEY (PensionTypeID) References PensionType ( RecID ),

Constraint FK_PensionerStaff FOREIGN KEY (StaffID) References Staff ( RecID ),

Constraint FK_PensionerOrders FOREIGN KEY (OrdersID) References Orders ( RecID ),

CONSTRAINT U_PensionerStaffID UNIQUE ( StaffID)

);

Alter Table PeriodAssign Add (

Constraint FK_PeriodAssignDepartment FOREIGN KEY (DepartmentID) References Department ( RecID )

);

Alter Table Place Add (

Constraint FK_PlaceProfession FOREIGN KEY (ProfessionID) References Profession ( RecID ),

Constraint FK_PlaceDepartment FOREIGN KEY (DepartmentID) References Department ( RecID ),

Constraint FK_PlaceTypeQuantity FOREIGN KEY (TypeQuantityID) References TypeQuantity ( RecID ),

Constraint FK_PlaceSalaryType FOREIGN KEY (SalaryTypeID) References SalaryType ( RecID )

);

Alter Table PlaceEmpAssoc Add (

Constraint FK_PlaceEmpAssocPlace FOREIGN KEY (PlaceID) References Place ( RecID ),

Constraint FK_PlaceEmpAssocAddressee FOREIGN KEY (AddresseeID) References Addressee ( RecID ),

Constraint FK_PlaceEmpAssocStaff FOREIGN KEY (StaffID) References Staff ( RecID ),

Constraint FK_PlaceEmpAssocOrders FOREIGN KEY (OrdersID) References Orders ( RecID ),

CONSTRAINT U_PlaceEmpAssocU1 UNIQUE ( DateStart, DateEnd, StaffID, PlaceID)

);

Alter Table Profession Add (

Constraint FK_ProfessionGP FOREIGN KEY (GroupProfessionID) References GroupProfession ( RecID ),

CONSTRAINT U_ProfessionU1 UNIQUE ( Code)

);

Alter Table QueueOfApartmentReceiver Add (

Constraint FK_QOARqueueingS FOREIGN KEY (Staff_queueingID) References Staff ( RecID ),

Constraint FK_QOARRDQ FOREIGN KEY (ReasonDissQueueID) References ReasonDissQueue ( RecID ),

CONSTRAINT U_QOARS_ID UNIQUE ( Staff_queueingID)

);

Alter Table Staff Add (

Constraint FK_StaffGrade FOREIGN KEY (GradeID) References Grade ( RecID ),

Constraint FK_StaffNationality FOREIGN KEY (NationalityID) References Nationality ( RecID ),

Constraint FK_Staffbirth_inCity FOREIGN KEY (City_birth_inID) References City ( RecID ),

Constraint FK_Stafflives_inCity FOREIGN KEY (City_lives_inID) References City ( RecID ),

Constraint FK_StaffMaritalStatus FOREIGN KEY (MaritalStatusID) References MaritalStatus ( RecID ),

CONSTRAINT U_StaffU1 UNIQUE ( FamilyName, FirstName, SecondName, LastPersonnellNo)

);

Alter Table StaffProfAssoc Add (

Constraint FK_StaffProfAssocProfession FOREIGN KEY (ProfessionID) References Profession ( RecID ),

Constraint FK_StaffProfAssocStaff FOREIGN KEY (StaffID) References Staff ( RecID )

);

Alter Table StaffQualAssoc Add (

Constraint FK_StaffQualAssocQ FOREIGN KEY (QualificacionID) References Qualificacion ( RecID ),

Constraint FK_StaffQualAssocStaff FOREIGN KEY (StaffID) References Staff ( RecID ),

CONSTRAINT U_StaffQualAssocUL UNIQUE ( QualificacionID, StaffID)

);

Alter Table StaffTable Add (

Constraint FK_StaffTableLostTimeType FOREIGN KEY (LostTimeTypeID) References LostTimeType ( RecID ),

Constraint FK_StaffTableStaff FOREIGN KEY (StaffID) References Staff ( RecID ),

Constraint FK_StaffTableTimeTable FOREIGN KEY (TimeTableID) References TimeTable ( RecID ),

Constraint FK_StaffTableOutPutesItem FOREIGN KEY (OutPutesItemID) References OutPutesItem ( RecID )

);

Alter Table Stock Add (

Constraint FK_StockStore FOREIGN KEY (StoreID) References Store ( RecID ),

Constraint FK_StockPart FOREIGN KEY (PartID) References Part ( RecID ),

Constraint FK_StockAccountPlan FOREIGN KEY (AccountPlanID) References AccountPlan ( RecID ),

CONSTRAINT U_StockU1 UNIQUE ( CardNo)

);

Alter Table StockAttrAssoc Add (

Constraint FK_StockAttrAssocStock FOREIGN KEY (StockID) References Stock ( RecID ),

Constraint FK_StockAttrAssocPA FOREIGN KEY (PartAttributeID) References PartAttribute ( RecID )

);

Alter Table StockDocItem Add (

Constraint FK_StockDocItemStock FOREIGN KEY (StockID) References Stock ( RecID ),

Constraint FK_StockDocItemDocumentItem FOREIGN KEY (DocumentItemID) References DocumentItem ( RecID )

);

Alter Table SuppPayAkkreditive Add (

Constraint FK_SuppPayAkkreditiveA FOREIGN KEY (AkkreditiveID) References Akkreditive ( RecID ),

Constraint FK_SuppPayAkkreditiveSP FOREIGN KEY (SuppPaymentID) References SuppPayment ( RecID ),

CONSTRAINT U_SuppPayAkkreditiveSPID UNIQUE ( SuppPaymentID, AkkreditiveID)

);

Alter Table SuppPayBooking Add (

Constraint FK_SuppPayBookingSP FOREIGN KEY (SuppPaymentID) References SuppPayment ( RecID ),

Constraint FK_SuppPayBookingBD FOREIGN KEY (BookkeepDocID) References BookkeepDoc ( RecID ),

CONSTRAINT U_SuppPayBookingBDID UNIQUE ( BookkeepDocID, SuppPaymentID)

);

Alter Table Tarife Add (

Constraint FK_TarifeOrders FOREIGN KEY (OrdersID) References Orders ( RecID )

);

Alter Table WorkersChild Add (

Constraint FK_WorkersChildhe_fatherS FOREIGN KEY (Staff_he_fatherID) References Staff ( RecID ),

Constraint FK_WorkersChildhe_motherS FOREIGN KEY (Staff_he_motherID) References Staff ( RecID ),

Constraint FK_WorkersChildisStaff FOREIGN KEY (Staff_isID) References Staff ( RecID ),

CONSTRAINT U_WorkersChildStaff_isID UNIQUE ( Staff_isID)

);