code: def fielddefsql_from_fieldspec(fieldspec: FIELDSPEC_TYPE) -> str:
          
          sql = fieldspec["name"] + " " + fieldspec["sqltype"]
          if "notnull" in fieldspec and fieldspec["notnull"]:
              sql += " NOT NULL"
          if "autoincrement" in fieldspec and fieldspec["autoincrement"]:
              sql += " AUTO_INCREMENT"
          if "pk" in fieldspec and fieldspec["pk"]:
              sql += " PRIMARY KEY"
          else:
              if "unique" in fieldspec and fieldspec["unique"]:
                  sql += " UNIQUE"
          if "comment" in fieldspec:
              sql += " COMMENT " + sql_quote_string(fieldspec["comment"])
          return sql
docs: Returns SQL fragment to define a field.