Лабораторная работа: Проектирование РБД "Санатория" с помощью инструментария AllFusion ERwin Data Modeler
Set ERwinTableDef = ERwinDatabase.TableDefs("Client")
Set ERwinIndex = ERwinTableDef.CreateIndex("PrimaryKey")
Set ERwinField = ERwinIndex.CreateField("ID client")
ERwinIndex.Fields.Append ERwinField
Set ERwinField = ERwinIndex.CreateField("ID enterprise")
ERwinIndex.Fields.Append ERwinField
Set ERwinField = ERwinIndex.CreateField("Number of flat")
ERwinIndex.Fields.Append ERwinField
ERwinIndex.Primary = True
ERwinTableDef.Indexes.Append ERwinIndex
' CREATE TABLE "Department"
Set ERwinTableDef = ERwinDatabase.CreateTableDef("Department")
Set ERwinField = ERwinTableDef.CreateField("ID department", DB_INTEGER)
ERwinField.Required = True
ERwinTableDef.Fields.Append ERwinField
Set ERwinField = ERwinTableDef.CreateField("Department name", DB_TEXT, 18)
ERwinTableDef.Fields.Append ERwinField
Set ERwinField = ERwinTableDef.CreateField("Legal address", DB_TEXT, 18)
ERwinTableDef.Fields.Append ERwinField
ERwinDatabase.TableDefs.Append ERwinTableDef
' CREATE INDEX "PrimaryKey"
Set ERwinTableDef = ERwinDatabase.TableDefs("Department")
Set ERwinIndex = ERwinTableDef.CreateIndex("PrimaryKey")
Set ERwinField = ERwinIndex.CreateField("ID department")
ERwinIndex.Fields.Append ERwinField
ERwinIndex.Primary = True
ERwinTableDef.Indexes.Append ERwinIndex
' CREATE TABLE "Department_Client"
Set ERwinTableDef = ERwinDat base.CreateTableDef("Department_Client")