Since this is my first day of learning SQL, I am trying to add a foreign key to a column in a table referring to another column in another table. I am getting an error like "Error Code 1215: Cannot add Foreign Key Constraint". I have read the documentation on many websites, I couldn't get any solutions. I am not familiar with technical language or knowledge in SQL, so help me with simple answers to proceed further. Thanks in advance.
Here is the snippet I used to add a foreign key to an existing table. "ALTER TABLE location_details ADD CONSTRAINT FK_location FOREIGN KEY (Zip) REFERENCES student_details(Zip);"