In: Computer Science
Design a database/mysql that has 3 tables:
TABLE 1 student: StudID (int), LastName (varchar), FirstName (varchar), MiddleName(varchar)
TABLE 2 Course: StudID, CourseID
TABLE 3 study course: CourseID(int), CourseTitle(varchar), Units(int), PreqCourse(varchar)
** Insert at least 5 records.
** Use the "select" command to view the content of the tables.
** POST THE SCREENSHOT
Hi, here is your code. Please give an upvote. If you have any doubts regarding my answer, tell me in the comments. I would be very happy to help you.
CODE TO COPY:
create table student(StudID integer, LastName varchar(100), Firstname varchar(100), MiddleName varchar(100), Primary key (StudID));
create table study_Course(CourseID integer, CourseTitle varchar(100), Units integer, PreqCourse varchar(100), Primary key(CourseID));
create table Course(StudID integer, CourseID integer, Foreign Key (StudID) references student(StudID), Foreign key (CourseID) references study_Course(CourseID)) ;
insert into student values (101,"Messi","Leo","Andreas");
insert into student values (102,"Ronaldo","Cristiano","Dos Santos");
insert into student values (103,"Tendulkar","Sachin","Ramesh");
insert into student values (104,"Muller","Frank","Roberto");
insert into student values (105,"Simmons","James","Anto");
insert into Course values (101,1);
insert into Course values (102,2);
insert into Course values (103,3);
insert into Course values (104,4);
insert into Course values (105,5);
insert into study_Course values (1, "Java", 2, "C++");
insert into study_Course values (2, "Python", 5, "Basic Programming Concepts");
insert into study_Course values (3, "Database Connectivity with Web Application", 7, "DBMS");
insert into study_Course values (4, "Competitive Programming", 3, "Data Structures/Algorithms");
insert into study_Course values (5, "CCNA Course", 2, "Computer Network");
select s.StudID, s.LastName, sc.CourseTitle
from student s, study_Course sc, Course c
where s.StudID = c.StudID and sc.CourseID = c.CourseID;
SCREENSHOTS: