MySQL Forums
Forum List  »  Newbie

Multi rows
Posted by: Nobi One
Date: November 27, 2022 05:36AM

Hi guys
I am new here and I looking for some advice as I am struggling with the code,
Am I doing a table where 1 employee has many courses how I should run it?
CREATE TABLE Emplyoee
(
EmpID CHAR(5) NOT NULL,
Forname VARCHAR(50) NOT NULL,
Surname VARCHAR(50) NOT NULL,
Gender VARCHAR(10) NOT NULL,
DOB DATE NOT NULL,
PRIMARY KEY (EmpID)
);
Then I have data
INSET INTO Employee (EmpID, Forname, Surname, Gender, DOB)

and then I have to create another table
where 1 employee have 3 course (how to do it?)
CREATE TABLE Result
(
EmpID int DEFAULT(9),
CoursID varchar(45) NOT NULL,
Result int(3) NOT NULL,
PRIMARY KEY (EmpID,CourseID)
);
and now is a problem as I can't put for example same id for 3 Different courses
how to run this code then?
Thanks in adavance

Options: ReplyQuote


Subject
Written By
Posted
Multi rows
November 27, 2022 05:36AM
November 28, 2022 04:52AM
November 28, 2022 08:19AM
November 29, 2022 05:39AM
November 30, 2022 10:00AM
December 06, 2022 01:32PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.