Posts

Showing posts from January, 2019

Mysql Primary Foreign for Beginners

Here I am goving to create two tables first will be parent and second will be child table. Table are Student and Marks In student table we make rollno as primary key which is act as a foreign in Marks table. ------------------------------------------------------------------------------------------------------------------- sql>> create table student (roll int primary key,name text) sql>> create table marks(sub1 int,sub2 int, sub3 int ,roll int, foreign key(roll) references student (roll)); ------------------------------------------------------------------------------------------------------------------- sql>show tables; student marks here we can created two table succesfully with paarent child relatoinship. --------------------------------------------------------------------------------------------------------------------- Insert data ----------------- If i try to insert data in child table (example Marks table) without adding data in Parent t