Mysql add foreign key to existing table12/11/2023 ![]() ![]() We then created a Master table named student and a child table named teacher. StudentName varchar(50), studentAddress varchar(100)) Ĭreate table teacher (teacherId int not null primary key auto_increment,įoreign key (studentId) references student (studentId)) create table student (studentId int not null primary key auto_increment, Here, use is a keyword in MySQL to use a database. create database school Ĭreated a database and named it a school. Let's understand this better by taking an example with the help of MySQL.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |