'SQLite python not returning false on an empty select

Hi having some issues with SQLite3 been having a good time with it up until now but recently ran into some issues when I was trying to check if a select statement looking at all the usernames in the database is fault such that there is no user with that username already to add the newly registered user to the database I'd really appreciate some help the code is below

if form.validate_on_submit():
    email = form.email.data
    username = form.username.data
    password = form.password.data
    hashedpassword = sha256_crypt.hash(password)
    print(email, username, hashedpassword)
    db = get_db()
    if not db.execute(f'SELECT * FROM USERS WHERE "{username}" == USERNAME'):
        cursor = db.execute(
        f'INSERT INTO USERS(USERNAME, USERPASSWORD, USEREMAIL) VALUES(?,?,?)', (username, hashedpassword, email)
        )
        db.commit() 


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source