Search code examples
mysqlmysql-error-1064

How to insert a row of data in my MySQL table from command line?


I'm using MySQL command line and need to insert data into my table. I'm having a major brain fart and feel really rusty on this and cannot remember on how to do this correctly. Here is how my table looks currently:

enter image description here

I deleted items from my database, and this is all that is left in my books table. I want to add another book that has the title "Faith" and the author "Nelson", so I tried the following command, but get an error as you can see below:

enter image description here

I don't want to enter information for the key, I want it to generate automatically without me having to manually enter it. Can someone please show me how to enter this data correctly? Thanks.


Solution

  • Try this:

    INSERT INTO books (`title`, `author`)
    VALUES
        ('faith', 'nelson');