For each of the following statements, show whether the statement is correctly executed or not (assume that the statements are executed in order, which means that if a statement is correctly executed, its effect is reflected in the following statement). If you say the statement is not executed, explain why. a. INSERT INTO Students VALUES (3, ‘Ellen’);
CREATE the following table on mySQL
Consider the following
Table name: Students Primary key: sid
Sid |
sname |
7 |
Ricky |
2 |
Ellen |
6 |
MaryLou |
4 |
Ellen |
Table name: Courses Primary key: cid
cid |
cname |
1 |
ICS |
2 |
Finance |
Table name: Register Primary key: sid,cid
Foreign key: sid references Students(sid)
Foreign key: cid references Courses(cid)
sid |
cid |
7 |
2 |
2 |
2 |
7 |
1 |
4 |
1 |
Expert Answer
Here have to determine sql statement for given problem.
Answer,:::
Here i have given Sql query statment of your given problem statement.
1) CREATE TABLE Students (
Sid int not null primary key,
sname varchar(255)
);
INSERT INTO Students
(Sid, sname)
VALUES
(7, "Ricky"),
(2, "Ellen"),
(6, "MaryLou"),
(4, "Ellen") ;
2) CREATE TABLE Courses (
Cid int not null primary key,
cname varchar(255)
);
INSERT INTO Courses
(Cid, cname)
VALUES
(1, "ICS"),
(2, "finance");
3) CREATE TABLE Register (
Sid int not null,
Cid int not null,
FOREIGN KEY (cid) REFERENCES Courses(cid),
FOREIGN KEY (sid) REFERENCES student (sid)
);
For each of the following statements, show whether the statement is correctly executed or not (assume that the statements are executed in order, which means that if a statement is correctly executed, its effect is reflected in the following statement). If you say the statement is not executed, explain why.
a. INSERT INTO Students VALUES (3, ‘Ellen’);
b. INSERT INTO Students VALUES (6, ‘Ellen’);
c. INSERT INTO Register VALUES (1, 2);
d. INSERT INTO Courses VALUES (5, ‘Systems’);
e. INSERT INTO Register VALUES (6, 5);
f. INSERT INTO Register VALUES (3, 5);
Trending now
This is a popular solution!
Step by step
Solved in 2 steps