How to display specific row from sqlite3 DB?

Good day! The issue is that I need to get a specific string from the entire database, not via WHERE. How to make so that, for example, the user came back with the line he had just filled? Or, at least, only the id? Code snippet:
def registration():
 NAME = input('what is your name?(For Example, John): ')
 SURNAME = input('Enter the last name (E.g. Smith): ')
 PATRONYMIC = input('Enter middle name (for Example, I.: ')
 CLASS = input('which class are you studying? (For example, 6A) : ')
 cursor.execute('INSERT INTO ids (name, surname, patronymic, class) VALUES (NAME, SURNAME, PATRONYMIC, CLASS)')

def take(cursor):
 book = input('What book do you want to take? (enter only the name): ')
 user_id = ('Please enter your id: ')
 cursor.execute(")


Code, of course, conditional, but should work with such a fragment)
In the last cursor.execute, I think, and should be output)
April 7th 20 at 15:52
2 answers
April 7th 20 at 15:54
not via WHERE

Why limit yourself? Right through WHERE they had to do. Judging by your code, the problem you have is that you don't know what to write WHERE. Because you are not the record id.
You need to do the following. At the beginning of the login session to generate the next unique id (could be different). When the registered data, this id is saved together with the data.
And if necessary, data to - extract them from the database using the condition WHERE id = currentId
April 7th 20 at 15:56
Actually only through WHERE.
cursor.execute("SELECT * FROM table WHERE name = %s AND surname = %s", (var1, var2))

Here %s are the placeholders for the input values, and also protect you from SQL injection.

It will be useful to read this article: https://habr.com/ru/post/321510/

Find more questions by tags PythonSQLite