⊗pyPmDBMVS 115 of 128 menu

Fetching the minimum value in SQL in Python

To select one minimum value from all records, the function MIN should be applied.

Let's select a user with the minimum id:

query = "SELECT MIN(id) FROM users"

The result of the executed code:

{'MIN(id)': 1}

Select the youngest user from the table.

Among users whose age is greater than 25, select the one with the lowest salary.

enru