Similar Posts

Subscribe
Notify of
8 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
ElvanL77
1 year ago

Your PrimaryKey “autoID” is not in the “sales contract” table. The foreign key must exist in both tables.

Your database (table) structure is quite bumpy.

In your position, I would look again at the relationships between your tables. keyword 1 to 1 / 1 too much / many too many…

If a sales contract (I find this name unhappy, think it is a purchase contract) can be assigned to one or more cars… then you only need to store the “sales contract ID” as FS in the “auto” table.

First of all, if you want to establish even more relationships with other tables, that ends… if you keep doing so… in a pretty mess;) (not mean evil)

Also look at the normal forms for databases… you should stick to the 3rd. (that is, also to the 1st and 2nd)

ElvanL77
1 year ago
Reply to  BONEz851

Oh, I was looking at the question. I didn’t want to do your work, but I didn’t want to 😉 (also not mean evil again, honestly)

All right, let’s take a look at this…

  • no address for sellers and customers (why, does not make any sense)
  • under “Sales” the point… “Sales Cars” (how do you imagine? ID’s separated with comma 😉 )
  • generally lack many, many data that are necessary.
  • already the first normal form is not really maintained (atomize) name should be separated in first and last name (in 2 tables)
  • the large and small description of your tables and indexes, are a real gray keyword: uniform / view terms

… etc.

I don’t want to be small, but you have to get it again.

P.S. I like to help, but I don’t do the work for you… at least not for free;)

Xandros0506
1 year ago

A foreign key cannot be AUTOID. The value is not generated in this table, but is already specified in the table in which this value is the primary key.

If a primary key is created as a AUTOID in a table, this value is stored as a foreign key in the linked table as a INT.