Consider the activity models and answer the questions provided. First reflect on these questions on your own briefly, before discussing and comparing your thoughts with your group. Appoint one member of your group to discuss your findings with the class, and the rest of the group should help that member prepare their response. Answer each question individually from the activity, and compare with your group to prepare for our whole-class discussion. After class, think about the questions in the reflective prompt and respond to those individually in your notebook. Report out on areas of disagreement or items for which you and your group identified alternative approaches. Write down and report out questions you encountered along the way for group discussion.
Model 1: Relational Databases
People
PersonID
Name
Age
1
Bill
38
2
Alex
25
3
Lee
19
Questions
Draw a flow chart of the function calls in the MySql example program.
Model 2: The SQL Join
People
PersonID
Name
Age
1
Bill
38
2
Alex
25
3
Lee
19
Courses
CourseID
Name
CourseNumber
1
Introduction to Computer Science
CS173
2
Object Oriented Programming
CS174
3
Web and Mobile Development
CS471
Enrollments
EnrollmentID
CourseID
PersonID
1
1
1
2
2
1
3
2
2
4
2
3
SELECT * FROM Enrollments
INNER JOIN Courses ON Enrollments.CourseID = Courses.CourseID
INNER JOIN People ON Enrollments.PersonID = People.PersonID;
Questions
What are the primary keys and foreign keys in the tables above?
What do you think JOIN means?
What is the resulting table generated by the query above?
Why not just have a single table with the course name, person name in it to begin with, like the one you obtained through the JOIN statement?
Model 3: Sanitizing Database Inputs
Questions
What is the problem being demonstrated here? How might you write a program that is vulnerable to this type of attack?
In the first example, why is the code hard to follow?
If you put a process.exit()statement at the bottom of the first example, what do you think would happen?
In the second example, why is there a return statement in the middle of execution? This statement does not return from the function: what do you think it does?
What are the advantages and disadvantages of the await statements in the third example?
Embedded Code Environment
You can try out these code examples in a development environment of your choice! Note that some embedded projects have multiple source files; you can see those by clicking the appropriate file tab to open that file.
Example: Express MySQL Example
Submission
I encourage you to submit your answers to the questions (and ask your own questions!) using the Class Activity Questions discussion board. You may also respond to questions or comments made by others, or ask follow-up questions there. Answer any reflective prompt questions in the Reflective Journal section of your OneNote Classroom personal section. You can find the link to the class notebook on the syllabus.