I'm new to database and my entity-relationship diagram is as follows:
According to that I designed my SQL-DDL database statements as shown below:
CREATE TABLE Developer ( DeveloperID int NOT NULL AUTO_INCREMENT, Name varchar(255), Primary key(DeveloperID) ); CREATE TABLE Manager ( ManagerID int NOT NULL AUTO_INCREMENT, Name varchar(255), Primary key(ManagerID) ); CREATE TABLE Project ( ProjectID int AUTO_INCREMENT, Name varchar(255), ManagerID int, Primary key(ProjectID), CONSTRAINT FK_Manager FOREIGN KEY (ManagerID) REFERENCES Manager(ManagerID) ); CREATE TABLE Task ( TaskID int AUTO_INCREMENT, DeveloperID int NOT NULL, ProjectID int NOT NULL, Descriptions varchar(255), Primary key(TaskIDTaskID), CONSTRAINT FK_Developer FOREIGN KEY (DeveloperID) REFERENCES Developer(DeveloperID), CONSTRAINT FK_Project FOREIGN KEY (ManagerID) REFERENCES Project(ProjectID) );
But I'm not sure if this is correct or not, because I'm not using any other table for works (there are many-to-many relationships). If I create a table for that, I think it's useless for me. Can anyone tell me if this structure is correct or not? If incorrect, please tell me what should I do to improve it.