Лабораторная работа: Проектирование РБД "Санатория" с помощью инструментария AllFusion ERwin Data Modeler
' CREATE TABLE "Motor transport"
Set ERwinTableDef = ERwinDatabase.CreateTableDef("Motor transport")
Set ERwinField = ERwinTableDef.CreateField("State number", DB_TEXT, 18)
ERwinField.Required = True
ERwinTableDef.Fields.Append ERwinField
Set ERwinField = ERwinTableDef.CreateField("ID department", DB_INTEGER)
ERwinField.Required = True
ERwinTableDef.Fields.Append ERwinField
Set ERwinField = ERwinTableDef.CreateField("Car's brand", DB_TEXT, 18)
ERwinTableDef.Fields.Append ERwinField
Set ERwinField = ERwinTableDef.CreateField("Explotation time", DB_DATETIME)
ERwinTableDef.Fields.Append ERwinField
Set ERwinField = ERwinTableDef.CreateField("Date maintenance", DB_DATETIME)
ERwinTableDef.Fields.Append ERwinField
ERwinDatabase.TableDefs.Append ERwinTableDef
' CREATE INDEX "PrimaryKey"
Set ERwinTableDef = ERwinDatabase.TableDefs("Motor transport")
Set ERwinIndex = ERwinTableDef.CreateIndex("PrimaryKey")
Set ERwinField = ERwinIndex.CreateField("State number")
ERwinIndex.Fields.Append ERwinField
ERwinIndex.Primary = True
ERwinTableDef.Indexes.Append ERwinIndex
' CREATE TABLE "Permit"
Set ERwinTableDef = ERwinDatabase.CreateTableDef("Permit")
Set ERwinField = ERwinTableDef.CreateField("ID permit", DB_INTEGER)
ERwinField.Required = True
ERwinTableDef.Fields.Append ERwinField
Set ERwinField = ERwinTableDef.CreateField("ID client", DB_INTEGER)
ERwinField.Required = True