The input file holds a grade (e.g. A).
Find every enrolment that was awarded exactly that grade. Join takes to student to course, keeping only rows whose grade equals the input value. For each such enrolment report the student's name, the course title, and the grade.
Output one row per enrolment, columns space-separated in this exact order:
student_name course_title grade
Order the rows by student_name, then course_title (both ascending).
Note: Do not hard-code the database name — your program is run against a different database instance for evaluation. The input file is in the same folder as your program.
For the database connection, use these variables:
database = sys.argv[1] # database name, from the command line
user = os.environ.get('PGUSER')
password = os.environ.get('PGPASSWORD')
host = os.environ.get('PGHOST')
port = os.environ.get('PGPORT')
The input is a file named grade.txt in the same folder — A single grade string, e.g. A or B+..
primary keyforeign keyarrow points to the referenced columndrag to pan