with WineDBf do
begin
TableLevel := 7;
Exclusive := True;
FieldDefs.Add('ID', ftAutoInc, 0, True); // Field[0]
FieldDefs.Add('WineID', ftInteger, 0, True);
FieldDefs.Add('WineName', ftString, 60, True);
FieldDefs.Add('Vintage', ftString, 4, True);
FieldDefs.Add('Quantity', ftInteger, 0, True);
FieldDefs.Add('Size', ftString, 12, True);
FieldDefs.Add('Region', ftString, 25, True);
FieldDefs.Add('Country', ftString, 25, True);
FieldDefs.Add('Date', ftDateTime, 0, True); // Field[8]
FieldDefs.Add('NoteID', ftInteger, 0, True);
CreateTable;
Open;
// Add data here
Append;
Fields[1].AsInteger := 1;
Fields[2].AsString := 'Ch. Smith Haut Lafitte';
Fields[3].AsString := '1988';
Fields[6].AsString := 'Bordeaux';
Fields[7].AsString := 'France';
Fields[4].AsInteger := 0;
Fields[5].AsString := 'Bottle';
//Fields[8].AsDateTime := StrToDateTime('10/2/1991');
Fields[9].AsInteger := 0;
Post;
AddIndex('idxByID', 'ID', [ixPrimary, ixUnique]);
AddIndex('idxByWineID', 'WineID', [ixUnique]);
AddIndex('idxByCountry', 'Country', [ixCaseInsensitive]);
AddIndex('idxByName', 'WineName', [ixCaseInsensitive]);
AddIndex('idxByNameRev', 'WineName', [ixDescending, ixCaseInsensitive]);
end;