Question

In: Computer Science

A college records the module registration information of their students in a database named College.mdb,which contains...

A college records the module registration information of their students in a database named College.mdb,which contains three tables,STUDENT,MODULE andMODULE_REG. A student may enroll in the same module as many times as they like. However, they can only enroll each module at most once in each semester. The design of the three tables are shown below:

Table STUDENT

Field Name

Data Type

Note

SID

Short Text

primary key

FirstName

Short Text

LastName

Short Text

Contact

Short Text

Gender

Short Text

“M” or “F”

Table MODULE_REG

Field Name

Data Type

Note

StudentID

Short Text

ModuleCode

Short Text

Year

Number

Semester

Number

Score

Number

Table MODULE

Field Name

Data Type

Note

ModuleCode

Short Text

primary key

ModuleName

Short Text

Download the database file College.mdbfrom Moodle. Rename it as College_Lxx_syyyyyy.mdb(where Lxxis your class andsyyyyyyis your student number, e.g. College_L01_s170001.mdb/College_L01_s170001.accdb) and complete the following tasks.

(a) Create a primary key of the table MODULE_REG.                                                                (1 mark)

(b)   Establish the relationships between the tables STUDENT,MODULE andMODULE_REG.      (1 mark)

(c)    Create queries to perform the following tasks:

  1. Display the student IDs, studentnames (including both first name and last name), as well as the code and name of modules that each student had enrolled in the secondsemester of 2019. Arrange the records in ascendingorder of the student IDs. Save the query as Q1.
    Note: You mustnotshow the semester and the year in the output.                            

(ii) Display the total number of students in each gender. Save the query as Q2.              

  1. Produce a list of module codes, module names, and the total number of enrollment records of each module. Arrange the records in ascendingorder of the total number of enrollment records of each module. Save the query as Q3.

Produce a list of module codes, module names, student names (including both first name and last name), and student IDs of enrolled students for all modules with module codes beginning with “COM” being registered in the firstsemester of 2019. Arrange the records in ascendingorder of module codes. Save the query as Q4.
Note: You mustnotshow the semester and the year in the output.

Solutions

Expert Solution

Create table Student with the given fields and SID as Primary key

Create Table Module with the given fields and Modulecode as Primary key.

Create Module_Reg with the given fields.

a) Creating Primary key

In the Module_Reg table the primary key is a composite key of StudentID and ModuleCode.

To do this ctrl select two filelds -> right click and select primary key.

Student Table:

Module Table:

Module _Reg Table:

----------------------------------------

b) Relationships:

In the Design tab -> click Relationships

Empty window with Tables at the right corner will be displayed.

Drag and drop all the tables in the window.

Drag the Primary key of Student(SID) to Module_Reg(StudentID)

In the dialog box select enforce referential integrity.

Likewise create the relation between Module and Module_Reg with ModuleCode

-----------------------------------------------------------

c) Query

Q1) design the query using design wizard (will be easier)

Click Create-> QueryDesign

A window with list of tables at the right corner will be opened.

Drag and drop the tables we need to process the query.

To process this query we need all 3 tables.

The query has to display the Student IDs, student names, module codes and names that has enrolled in the second semester of 2019.

The query is designed like this, enter the values as given in the figure. Save the Query as Q1.

The query

SELECT Student.SID, Student.FirstName, Student.LastName, Module_Reg.ModuleCode, Module.ModuleName
FROM [Module] INNER JOIN (Student INNER JOIN Module_Reg ON Student.SID = Module_Reg.StudentID) ON Module.ModuleCode = Module_Reg.ModuleCode
WHERE (((Module_Reg.Year)=2019) AND ((Module_Reg.Semester)=2))
ORDER BY Student.SID;

Output

-------------------------------

Q2)

Create the query as Q1.

In this query we have to aggragate function Count.

To include that in design view We have a icon called totals

click that totals we will be able to use all aggregate functions.

The values to be entered are:

Query:

SELECT Count(Student.Gender) AS CountOfGender
FROM Student
GROUP BY Student.Gender;

---------------------------------------------------------------

Q3)

Create Query in Design view. Save the query as Q3

Query:

SELECT Module.ModuleCode, Module.ModuleName, Count(Module_Reg.ModuleCode) AS CountOfModuleCode
FROM Student INNER JOIN ([Module] INNER JOIN Module_Reg ON Module.ModuleCode = Module_Reg.ModuleCode) ON Student.SID = Module_Reg.StudentID
GROUP BY Module.ModuleCode, Module.ModuleName
ORDER BY Module.ModuleCode;

Result:

---------------------------------------

Q4)

Unselect and the display option for Semester and Year.

Save the query as Q4

Query:

SELECT Module_Reg.ModuleCode, Module.ModuleName, Student.FirstName, Student.LastName, Student.SID
FROM Student INNER JOIN ([Module] INNER JOIN Module_Reg ON Module.ModuleCode = Module_Reg.ModuleCode) ON Student.SID = Module_Reg.StudentID
WHERE (((Module_Reg.ModuleCode) Like 'COM*') AND ((Module_Reg.Semester)=1) AND ((Module_Reg.Year)=2019))
ORDER BY Module_Reg.ModuleCode;

Result:


Related Solutions

During the registration at the State University every semester, students in the college of business must...
During the registration at the State University every semester, students in the college of business must have their courses approved by the college adviser. It takes the adviser an average of 2 minutes to approve each schedule, and students arrive at the adviser’s office at the rate of 28 per hour. Question 6: How long does a student spend waiting on average for the adviser? A. 13 minutes B. 14 minutes C. 30 minutes D. 28 minutes E. none of...
The database for a pet supply company includes the following table, named tblCollar, that contains product...
The database for a pet supply company includes the following table, named tblCollar, that contains product data for pet collars. The ItemDesc and Color fields contain text. The ItemNum, Price, and Quantity fields contain numbers. ItemNum ItemDesc Color Price Quantity 2358 leather studded collar black 30.00 35 2693 leather collar brown 25.00 25 3547 striped collar red 20.00 75 3855 striped collar blue 15.00 42 3764 striped collar green 15.00 48 5782 solid collar pink 12.00 36 5785 solid collar...
PLEASE USE ASSEMBLY LANGUAGE The database students.db contains student records. Each record contains a name (30B...
PLEASE USE ASSEMBLY LANGUAGE The database students.db contains student records. Each record contains a name (30B ASCII), student ID (9B ASCII), 3 grades out of 100 (3B integers), and a letter grade (1B ASCII). For the file students.db described above, assume all records are ordered alphabetically based on the name field. A record for a new student has been entered and stored in memory. Determine how to insert the new record into the database (Hint: use string compares to determine...
Using Python. A file exists on the disk named students.txt. The file contains several records, and...
Using Python. A file exists on the disk named students.txt. The file contains several records, and each record contains two fields: (1) the student’s name, and (2) the student’s score for the final exam. Write code that deletes the record containing “John Perz”as the student name. This the code i have so far but it's not working: import os def main(): found=False search='John Perz' student_file = open('student.txt','r') temp_file = open('temp_students.txt','w') name=student_file.readline() score='' while name !='': score=student_file.readline() name=name.rstrip('/n') score=score.rstrip('/n') if name...
Past records show that at a given college, 20% of the students who began as economics...
Past records show that at a given college, 20% of the students who began as economics majors either changed their major or dropped out of school. An incoming class has 110 beginning economics majors. What is the probability that at most 30% of these students will leave the economics program?
Which information is not contained in the prospectus of the registration statement? Multiple Choice A listing...
Which information is not contained in the prospectus of the registration statement? Multiple Choice A listing of directors and executive officers. An explanation of the intended use of the proceeds. A description of the risks associated with the securities. A description of the business of the registrant. A description of the properties of the registrant.
1 You're entering records into a database, and you realize you don't have the information for...
1 You're entering records into a database, and you realize you don't have the information for one of the fields. What do you do? Use letters in alphabetical order to select options A In the Field Properties section, change the Required field to Blank so users can skip the field during data entry. B Unless a field's set up to require an entry, you can skip the fields for which you don't have any data. C In order for a...
QUESTION 3 The following table contains ACT scores and the GPA for eight college students. Grade...
QUESTION 3 The following table contains ACT scores and the GPA for eight college students. Grade point average is based on a four-point scale and has been rounded to one digit after the decimal. Student GPA ACT 1 2.8 21 2 3.4 24 3 3 26 4 3.5 27 5 3.6 29 6 3 25 7 2.7 25 8 3.7 30 You estimate the following relationship between GPA and ACT: SUMMARY OUTPUT Regression Statistics Multiple R 0.759884064 R Square 0.577423791...
Previously, you wrote a program named Admission for a college admissions office in which the user...
Previously, you wrote a program named Admission for a college admissions office in which the user enters a numeric high school grade point average and an admission test score. The program displays Accept or Reject based on those values. Now, create a modified program named AdmissionModularized in which the grade point average and test score are passed to a method that returns a string containing Accept or Reject. CODE: using System; using static System.Console; class Admission {    static void Main()...
Sixty college students were asked where they shop online to determine on which websites the college...
Sixty college students were asked where they shop online to determine on which websites the college should place advertisements. The data from the random sample of students is represented below. They compared Etsy, Amazon, and Ebay. Test at the .05 level of significance. What are your null and alternative hypotheses? What is the critical value? Amazon Etsy Ebay 12 36 12 What is your decision? Reject the Null Fail to Reject the Null What is your interpretation of the following...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT