-
SitePoint Enthusiast
a basic mysql relationship question
beginner in need of help
I have created two tables
CREATE TABLE Topic (
Topic_ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
Topic_name TEXT,
Topic_info TEXT
);
CREATE TABLE Img (
Img_ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
Img_name TEXT,
Img_author TEXT
);
What i want to do is include the Img_ID in the Topic table(as a foreign key??) so i can refer to it through that table.
do i do it like this:
CREATE TABLE Topic (
Topic_ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
Topic_name TEXT,
Topic_info TEXT,
Img_Id INT NOT NULL AUTO_INCREMENT FOREIGN KEY,
);
any help would be great thanks in advance
g
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks