skip to Main Content

I’m working on a project for my class.

How can I enter a value into a table with the datatype "DATE"?

I tried using apostrophes, and without it.

I kept getting errors.

I’m using MySql.

Edit: I’m getting an Error 1054.

Error Code: 1054. Error Code: 1054. Unknown column ‘BorrowDate’ in ‘field list’

Columns and their datatype

https://phpout.com/wp-content/uploads/2024/02/7onNl.png

Values into table

enter image description here

I tried searching for the answer but I felt more confused since I’m still a newbie when it comes to learning SQL.

2

Answers


  1. Try adding a semicolon instead of a comma at the end. I applied the same code and it seems to work well. Or check whether you have entered a duplicate primary key value.
    Result Image

    Login or Signup to reply.
  2. Here is an Example:

    INSERT INTO events(event_name, event_date)
    VALUES('MySQL Conference','2023-10-29');
    

    https://www.mysqltutorial.org/mysql-basics/mysql-insert-date/

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search