0
Why this sql query showing me error.?
I have created two table and defined some attributes i have inserted data in course table when am inserting data in my students table it showing integrity constraints parent key not found what is the error am inserting same data in course_id which i have already inserted before CREATE TABLE course( course_id NUMBER, course_name VARCHAR2(255) NOT NULL, subject VARCHAR2(255) NOT NULL, PRIMARY KEY(course_id) ); CREATE TABLE student( s_id NUMBER, s_name VARCHAR2(255) NOT NULL, s_class VARCHAR2(255) NOT NULL, s_course NUMBER NOT NULL, s_address VARCHAR2(255) NOT NULL, PRIMARY KEY(s_id), FOREIGN KEY(s_course) REFERENCES course(course_id) );
6 Antworten
+ 1
Brian right now i have fixed this issue i have deleted my student table when i again typed same inserting command it worked
+ 1
Thanks for reply
0
The error would indicate that it could not find a match in course_id. Does the problem occur regardless of which course_id that you try? Could there be a nonprintable character in course_id or s_course, like a trailing space?
0
It showing integrity constraints parent key not found while i am inserted same data in s_course which i have inserted in course_id
0
Is the INSERT statement field order misaligned with the values?
Can you show us the exact INSERT statement here? If it is embedded SQL it helps to temporarily print the full query to the console so you can verify it.
0
Good job! 👍
It would be fair to mark your own reply as the answer. Maybe you'll get the badge for it!