def chooseQuery():
    conn = editTables.create_connection(DATABASE)
    print("-----------------------------------")
    print("\nPlease choose a query below:\n")
    print("    1. Shows global sales by Franchise")
    print("    2. Shows studios founded in each year")
    print("    3. Shows games grouped by genre")
    print("    4. Shows the games each developer has worked on")
    print("    5. Returns world record for each game")
    query = input('> ')
    if conn is not None:
        if query == '1':
            query_command = 'SELECT g.title,f.name,s.global from Games g natural join Sales s natural join Franchises f;'
        elif query == '2':
            query_command = 'SELECT name, yearFounded from Studios GROUP BY yearFounded;'
        elif query == '3':
            query_command = 'SELECT g2.name, g1.title from Games g1 natural join Genres g2 GROUP BY g2.name;'
        elif query == '4':
            query_command = 'SELECT d.name, g.title from Developers d natural join Games g GROUP BY d.name;'
        elif query == '5':
            query_command = 'SELECT r.title, r.player, r.bestTime from Records r;'
        else:
            print("INVALID INPUT")
        editTables.input_sql_command(conn, query_command)
    else:
        print("Error! Cannot create the database connection.")
def insertRecord():
    conn = editTables.create_connection(DATABASE)
    if conn is not None:
        print("Please enter the insert SQL command and data below:")
        insert_command = input('> ')
        editTables.input_sql_command(conn, insert_command)
    else:
        print("Error! Cannot create the database connection.")
def dropTable():
    conn = editTables.create_connection(DATABASE)
    if conn is not None:
        print("Please enter just the name of the table below:")
        table = input('> ')
        editTables.drop_table(conn, table)
    else:
        print("Error! Cannot create the database connection.")
def createTable():
    conn = editTables.create_connection(DATABASE)
    if conn is not None:
        print("Please enter the SQL table create command below:")
        create_table_sql = input('> ')
        editTables.input_sql_command(conn, create_table_sql)
    else:
        print("Error! Cannot create the database connection.")
def deleteRecord():
    conn = editTables.create_connection(DATABASE)
    if conn is not None:
        print("Please enter the table name below:")
        table = input('> ')
        print("Please enter the primary key value below ('primaryKey=1'):")
        value = input('> ')
        delete_command = ('DELETE FROM %s WHERE %s' % (table, value))
        editTables.input_sql_command(conn, delete_command)
    else:
        print("Error! Cannot create the database connection.")
def createDatabase():
    editTables.create_connection(DATABASE)
    print("Database Created")