程序代写代做代考 database COMP3311 20T3 The University of New South Wales Database Systems

COMP3311 20T3 The University of New South Wales Database Systems
COMP3311 Database Systems
20T3
[Instructions] [Notes] [Database] [Course Website] [Cheat Sheets]
[Q1] [Q2] [Q3] [Q4] [Q5] [Q6] [Q7] [Q8] [Q9] [Q10] [Q11] [Q12]
Question 6 (9 marks)
Write Python/Psycopg2 script that produces a list of match reports for a specified team T. The team is given as the first command-line argument and must exactly match the name of a team in the Teams table; if it doesn’t, print an error message and exit. The second command-line argument gives the year of interest Y.
If the team name is valid, print, in order of when the match was played, information about matches played by T in year Y. Each line in the match reports list contains:
opponent … the other team in the match location … the city where the match was played date … the date on which the match was played result … whether T won or lost
score … goals by T and goals by opponent
An example, to show the expected output format and error messages:
$ ./q6 ‘Australia’
Usage: q6 TeamName Year
$ ./q6 ‘australia’ 2002
No team ‘australia’ — not an EXACT match
$ ./q6 ‘Australia’ 1999
No matches
$ ./q6 ‘Australia’ 2006
played Argentina in Sydney on 2006-02-21 and drew 1-1 played Japan in Melbourne on 2006-05-20 and lost 0-2 played Netherlands in Melbourne on 2006-08-08 and won 1-0 played Japan in Kyoto on 2006-11-21 and drew 1-1
played Uruguay in San Carlos on 2006-12-24 and lost 1-2
The first goal is always the goal scored by team T.
There are more examples in the tests/*.expected files. Instructions:
Put the Python code in the file q6
Put any Python helper functions in this file as well
Place any helper views or PLpgSQL functions in the q6.sql file Load any SQL code via: psql footy -f q6.sql
Test it via: ./q6 ‘Australia’ 2006
Check it using: sh check q6
Submit it using: give cs3311 sample_q6 q6.sql q6 or
End of Question
Webcms3