Linked Questions

Popular Questions

I need to create 5 read only tables using Tkinter and the information that needs to be outputted needs to be pulled from a database I have created using SQLite3. 3 tables need to pull data from the database based on input from the user which is then ran through a SQL query. For example, if the user has to enter a date to search an appointment it should bring up all appointments with that date. 1 table needs to bring up all patient information from the patients table and the last table needs to bring up all the data in the bookings table based on the username that is currently logged in.

Ive tried putting the data into an array and displaying it that way but since I am inexperienced I would like the help.

c.execute('''SELECT Username, Forename, Surname, Email FROM Patients''')

This SQL Query is used to display all contents of the table.

c.execute('''SELECT Username, Forename, Surname, Email FROM Patients WHERE Surname=?''', (Store, ))

This SQL Query is used to pull data depending on the surname previously.

c.execute("""SELECT Patient_Username, Booking_Date, Booking_Time, Reason, Forename, Surname, Email FROM Bookings, Patients WHERE Patients.Surname=? AND Patients.Username=Bookings.Patient_Username""", (searchAppointment, ))

This SQL Query is used to search appointments when the user enters a specific surname.

c.execute("""SELECT Patient_Username, Booking_Date, Booking_Time, Reason, Forename, Surname, Email FROM Bookings, Patients WHERE Bookings.Booking_Date=?
AND Patients.Username=Bookings.Patient_Username
""", (searchDate, ))

This SQL Query is used to search for an appointment based on the date entered.

c.execute("SELECT Booking_Date, Booking_Time, Reason FROM Bookings WHERE Patient_Username=?", (Patient_User, ))

This SQL Query is used to pull up an appointment a user has made using the username currently logged in.

Related Questions