When linking two Tables the linked Fields in each Table must be the same data type and have the SAME NAME. Looking at the SQL you posted it appears to be trying to link “table2 ID” to “Table1 ID”.
Consider this example. A Database is being used to record orders received from customers. A “Customers” Table contains all the details for a customer. It has a “CustomerID” Field, the Primary Key. This can be created automatically by making it an Auto Value Integer. This will start at 0 and will be auto entered every time a new record is created in the Table and incremented by 1 for every new Record. An “Order” Table contains details of all orders. It has an “OrderID” field, the Primary Key which can be created again using Auto Value Integer. It also contains a “CustomerID” field as integer. A link is created between the “CustomerID” Fields in both Tables.
The “CustomerID” Field in the “Order” Table should not be the Primary Key as otherwise there could be only one order for a customer and there would be no point in having the Relational Model for the Database.
If when creating the link between the Tables the Cascade option is not set then you would not be able to delete any record from the Customer table which had orders in the Order Table as this breach the referential integrity of the Database. You would get an error from the Database Engine as it would result in orphaned records in the Orders Table - records which contained a “CustomerID” which no longer existed in the Customer Table.
If you set Delete Cascade on then when an attempt is made to delete a Customer from the Customer Table the Database Engine would also delete all records from the Orders Table with that “CustomerID” and this would not generate an error.
Similarly if Update Cascade is set to on and you wanted to change the “CustomerID” field to a different number, the records in the Order Table that had the “CustomerID” that was being changed would also be updated to the new number so that they would continue to be linked to the correct Customer. With Update Cascade set to off then changing the “CustomerID” Field would result in orphaned records whose “CustomerID” Field would be linked to a “CustomerID” Field that no longer existed and would not be allowed giving an error.