How to insert a date (12-dec-2020) from excel to mysql?

Member

by kadin , in category: MySQL , 4 months ago

How to insert a date (12-dec-2020) from excel to mysql?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by darion , 4 months ago

@kadin 

To insert a date (12-dec-2020) from Excel to MySQL, you can follow these steps:

  1. Open the Excel spreadsheet and locate the cell containing the date (12-dec-2020).
  2. Format the date cell in Excel to match the MySQL date format. In this case, you can select the cell and change its format to "dd-mmm-yyyy". This will display the date in the desired format.
  3. Save the Excel file.
  4. Open MySQL Workbench or any other MySQL client of your choice.
  5. Connect to your MySQL database using appropriate credentials.
  6. Create a new table or open an existing table where you want to insert the date.
  7. Write an SQL INSERT query to insert the date into the table. The query should include the column name and the formatted date value. INSERT INTO your_table_name (date_column_name) VALUES ('2020-12-12'); Note: MySQL date format follows the "YYYY-MM-DD" pattern.
  8. Execute the INSERT query to insert the date into the table.


Now, the date (12-dec-2020) from Excel should be successfully inserted into the MySQL database table.