代写Database Development and Design (DTS207TC)帮做数据库编程

Database Development and Design (DTS207TC)

Assessment 001: Individual Coursework

Weight: 60%

Maximum Marks: 100

Overview & Outcomes

This course work will be assessed for the following learning outcomes:

B. Demonstrate an understanding of advanced SQL topics.

C. Illustrate the issues related to Web technologies and DBMS and XML as a semi-structured data representation formalism.

D. Identify the principles underlying object-relational models.

Submission

You must submit the following files to LMO:

1)A report named as Your_Student_ID.pdf.

2)A directory containing all your source code, named as Your_Student_ID_code.

NOTE: The report shall be in A4 size, size 11 font, and shall not exceed 15 pages in length. You can include only key code snippets in your reports. The complete source code can be placed in the attachment.

Question 1: Intermediate SQL (20 marks)

You have been provided with three CSV files, which content is given in next page within this document, from the Academic Affairs Office of a university, containing information about students, courses, and course enrollments. Your task is to perform. the following operations in a PostgreSQL database:

1. Table Creation (10 marks):

• Create tables with suitable data types for students, courses, and course enrollments based on the data in the CSV files.

2. View Creation (5 marks):

• Create a view named student_course_view that includes the student's name, course name, grade, and GPA. The results should be sorted by the student's name in ascending order.

3. Query Execution (5 marks):

• Execute a query to retrieve data from the student_course_view and provide a screenshot of the query results.

Students.csv

student_id,name,gender,major,gpa

1,Alice,F,Computer Science,3.5

2,Bob,M,Mathematics,3.8

3,Charlie,M,Physics,3.2

4,Diana,F,Computer Science,3.9

5,Ethan,M,Mathematics,3.6

6,Fiona,F,Physics,3.7

7,George,M,Computer Science,3.4

8,Hannah,F,Mathematics,3.3

9,Ian,M,Physics,3.1

10,Julia,F,Computer Science,3.0

Courses.csv

course_id,course_name,credits,department

1,Database Systems,4,Computer Science

2,Calculus,3,Mathematics

3,Quantum Mechanics,5,Physics

4,Operating Systems,4,Computer Science

5,Linear Algebra,3,Mathematics

6,Classical Mechanics,5,Physics

7,Data Structures,4,Computer Science

8,Differential Equations,3,Mathematics

9,Electromagnetism,5,Physics

Enrollments.csv

enrollment_id,student_id,course_id,grade

1,1,1,85

2,2,2,90

3,3,3,78

4,4,1,92

5,5,2,88

6,6,3,85

7,7,4,80

8,8,5,82

9,9,6,76

10,10,7,88

11,1,8,90

12,2,9,85

13,3,1,80

14,4,2,88

15,5,3,92

16,6,4,85

17,7,5,80

18,8,6,82

19,9,7,76

20,10,8,88

Question 2: Advanced SQL (20 marks)

You are maintaining a student information management system that uses a PostgreSQL database. The database contains tables for students, classes, and grades with some existing data, as follows:

SQL

-- Create a class table

CREATE TABLE classes (

class_id SERIAL PRIMARY KEY,

class_name VARCHAR(100) NOT NULL,

average_score FLOAT

);

-- Create a student table

CREATE TABLE students (

student_id SERIAL PRIMARY KEY,

name VARCHAR(100) NOT NULL,

age INT,

class_id INT,

FOREIGN KEY (class_id) REFERENCES classes(class_id)

);

-- Create a grade sheet

CREATE TABLE grades (

grade_id SERIAL PRIMARY KEY,

student_id INT,

course_id INT,

score FLOAT,

FOREIGN KEY (student_id) REFERENCES students(student_id)

);

-- Insert class data

INSERT INTO classes (class_name) VALUES

('Class A'),

('Class B'),

('Class C');

-- Insert student data

INSERT INTO students (name, age, class_id) VALUES

('Alice', 20, 1),

('Bob', 22, 2),

('Charlie', 21, 1),

('David', 23, 3),

('Eve', 24, 2);

-- Insert grade data

INSERT INTO grades (student_id, course_id, score) VALUES

(1, 1001, 85.5),

(2, 1002, 90.0),

(3, 1001, 78.0),

(4, 1002, 88.5),

(5, 1001, 92.0);

Task

1. Create a stored procedure called insert_or_update_student to insert or update a new student into the student table. The stored procedure requires the student's name, age, and class ID as parameters. (We assume that there will be no students with the same name.) (8 marks)

2. Create a trigger to automatically calculate and update the class average when a grade is inserted or updated in the grades table. The class average is stored in a new field called average_score in the class table. (8 marks)

3. Test your program using the following statements and provide a screenshot of the results.(4 marks)

SQL

-- Insert a new student

CALL insert_or_update_student('Frank', 25, 1);

-- Insert a new grade

INSERT INTO grades (student_id, course_id, score) VALUES (1, 1003, 95.0);

-- Update an existing grade

UPDATE grades SET score = 98.0 WHERE student_id = 1 AND course_id = 1003;

Question 3: Complex Data Types (20 marks)

Suppose that an application needs to extract XML documents for student, course, and grade information from a UNIVERSITY database. The data needed for this information is stored in the database attributes of the entity COURSE, SECTION, and STUDENT with One-To-One and One-To-Many relationship of SECTION with COURSE and STUDENT. Consider the following Hierarchical (tree) view for a subset of a University database and answer the following questions:

(a)   Create XML DTD that corresponds to the given ER Diagram (the dotted box represents a weak entity). The DTD should be validated using the XML validation tool. (EditiX) (10 marks)

(b)   Create an XML instance document corresponding to the DTD you have created in the first step. The XML document must have at least one record for every element specified in the DTD. Validate the instance document against the DTD using the XML validation tool. (EditiX) (10 marks)

Question 4: ORM (20 marks)

Consider the following set of requirements for a UNIVERSITY database that is used to keep track of students’ transcripts.

● The university keeps track of each student’s name, student number, Social Security number, current address and phone number, permanent address and phone number, birth date, sex, class (freshman, sophomore, ..., graduate), major department, minor department (if any), and degree program (B.A., B.S., ..., Ph.D.). Some user applications need to refer to the city, state, and ZIP Code of the student’s permanent address and to the student’s last name. Both Social Security number and student number have unique values for each student.

● Each department is described by a name, department code, office number, office phone number, and college. Both name and code have unique values for each department.

● Each course has a course name, description, course number, number of semester hours, level, and offering department. The value of the course number is unique for each course.

● Each section has semester year, course, and section number. The section number distinguishes sections of the same course taught during the same semester/year; its values are 1, 2, 3, ..., up to the number of sections taught during each semester.

(a)   Design a UML class diagram for this application. Specify key attributes of each entity type and structural constraints on each relationship type. Note any unspecified requirements, and make appropriate assumptions to make the specification complete. (10 marks)

(b)   Translate the UML class diagram created in the above question (a) into a relational schema. In the relational schema, only use relation name and attribute, e.g., student (name, number, SSN,..etc.) and specify foreign key as fk. (10 marks)

Question 5: Data Warehousing (20 marks)

Suppose a company would like to design a data warehouse to facilitate vehicle analysis in an online analytical processing manner. The company registers huge amounts of vehicles’ data in the format of (Vehicle ID, Driver ID, location, speed, and time). Each Vehicle ID represents a vehicle associated with information, such as vehicle type, plate number, etc., each Driver ID represents information such as ID, name, age etc., and each location may be associated with a street in a city. Assume that a street map is available for the city. Speed represents miles/hour and time represents day, month, quarter and year. The company is interested to measure the total number of vehicles at a specific location and time as well as average mileage.

(a)   State which schema (star, snowflake etc.) is the most appropriate to model the above data warehouse. Give your opinion of which might be more empirically useful and state the reasons behind your answer. (6 marks)

(b)   Draw a schema diagram for the above data warehouse using one of the most appropriate schema diagrams. Dimension and fact tables must have all primary keys by introducing the attribute that identifies each entity. Furthermore, a complete schema diagram must capture associations among all the entities to perform. OLAP operations. (6 marks)

(c)   A driver may like to perform. online analytical processing to determine how to move fastest from one location to another location at a particular time. Discuss how this can be done efficiently by using data stored in the warehouse. (8 marks)



热门主题

课程名

mktg2509 csci 2600 38170 lng302 csse3010 phas3226 77938 arch1162 engn4536/engn6536 acx5903 comp151101 phl245 cse12 comp9312 stat3016/6016 phas0038 comp2140 6qqmb312 xjco3011 rest0005 ematm0051 5qqmn219 lubs5062m eee8155 cege0100 eap033 artd1109 mat246 etc3430 ecmm462 mis102 inft6800 ddes9903 comp6521 comp9517 comp3331/9331 comp4337 comp6008 comp9414 bu.231.790.81 man00150m csb352h math1041 eengm4100 isys1002 08 6057cem mktg3504 mthm036 mtrx1701 mth3241 eeee3086 cmp-7038b cmp-7000a ints4010 econ2151 infs5710 fins5516 fin3309 fins5510 gsoe9340 math2007 math2036 soee5010 mark3088 infs3605 elec9714 comp2271 ma214 comp2211 infs3604 600426 sit254 acct3091 bbt405 msin0116 com107/com113 mark5826 sit120 comp9021 eco2101 eeen40700 cs253 ece3114 ecmm447 chns3000 math377 itd102 comp9444 comp(2041|9044) econ0060 econ7230 mgt001371 ecs-323 cs6250 mgdi60012 mdia2012 comm221001 comm5000 ma1008 engl642 econ241 com333 math367 mis201 nbs-7041x meek16104 econ2003 comm1190 mbas902 comp-1027 dpst1091 comp7315 eppd1033 m06 ee3025 msci231 bb113/bbs1063 fc709 comp3425 comp9417 econ42915 cb9101 math1102e chme0017 fc307 mkt60104 5522usst litr1-uc6201.200 ee1102 cosc2803 math39512 omp9727 int2067/int5051 bsb151 mgt253 fc021 babs2202 mis2002s phya21 18-213 cege0012 mdia1002 math38032 mech5125 07 cisc102 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 math21112 efim20036 mn-3503 fins5568 110.807 bcpm000028 info6030 bma0092 bcpm0054 math20212 ce335 cs365 cenv6141 ftec5580 math2010 ec3450 comm1170 ecmt1010 csci-ua.0480-003 econ12-200 ib3960 ectb60h3f cs247—assignment tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 math350-real math2014 eec180 stat141b econ2101 msinm014/msing014/msing014b fit2004 comp643 bu1002 cm2030
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图