Page 1 of 3
CMPSC 321 Relational Database Theory and Design Lab 6: Forms and reports
Task 0: Install pymysql: A connector to the MySQL server 1. If you are using your own computer, you will have to install the connector as follows: 2. Make sure you have Python 3.7.1 on your PC or Mac. IF you do not have it, install this version for your laptop from https://www.python.org/downloads/release/python-37… 3. Once you have Python 3.7.1 installed: If you have a Mac, open a Terminal For Windows, open a Command Prompt 4. Type: pip install pymysql 5. Open the file Lab6_Task_1.py with a text editor (Notepad++, Sublime, Python’s IDLE) and hard-code your username and password: Just replace the strings for “user” and “passwd” with your userid and password. 6. Run it. (Use Python’s IDLE) Task 1: Forms 1. Run the Lab6_Examples.py program on Canvas. 2. Modify the program so that it asks the user for a client name and uses that in the query instead of always using “SkyJet”. 3. Run the program. Test to make sure you can get the ID of any client. 4. What happens if you enter a nonexistent manager ID? 5. In this case the result of fetchone is None. Modify the code so that the program displays a message like “There is no client matching that name.” 6. Show the result to the instructor. 7. Try a new result that asks the user for a manager ID and displays the first and last name of that manager. When you get that working, move on to the next task Task 2: Reports 8. We will create a report that displays information about a manager. 9. Modify the code from the end of Task 1 so that the manager’s salary is also displayed. 10. Modify the code so that the bonus is displayed next to the salary, if there is a bonus. If bonus is null, just display the salary. Hint: you can test if the item is not None to test if mbonus is not NULL. 11. Modify the code so that all the manager’s phone numbers are also displayed. This will require changing the SQL in the query, or executing a second query. You will also need a loop to print the rest of the phone numbers. 12. The output should look like this:
Please enter a manager ID: M23 Manager: Austin Lee Salary: 50000.0+5000.0 Phone numbers: 555-9988
Please enter a manager ID: M12 Manager: Boris Grant Salary: 60000.0 Phone numbers: 555-2
NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.
The post database science appeared first on Essay Writers.