⊗pyPmDBIMC 108 of 128 menu

Inserting Records with Missing Columns via SQL Query in Python

What happens if you don't specify a value for any column? Let's, for example, specify only the name and age:

query = "INSERT INTO users (name, age) VALUES ('user', 30)"

In this case, unspecified columns will take the default value. If such a value is not specified in the PMA, then this will result in an error and such a query will refuse to be executed:

1136 (21S01): Column count doesn't match value count at row 1

Add a new user 'xxxx' without specifying his age and salary.

enru