Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6703677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:11:59+00:00 2026-05-26T07:11:59+00:00

everyone I wanna add a column start_date whose default value is current date(), so

  • 0

everyone

I wanna add a column start_date whose default value is current date(), so I use following commands:

alter table validation add column start_date date default CURDATE()

but it didn’t work and told me it has syntax error.

While using such following command works well:

alter table validation add column start_date date default 0

Any suggestion is appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:11:59+00:00Added an answer on May 26, 2026 at 7:11 am

    From the online documentation (my bold):

    The DEFAULT value clause in a data type specification indicates a default value for a column. With one exception, the default value must be a constant; it cannot be a function or an expression.

    This means, for example, that you cannot set the default for a date column to be the value of a function such as NOW() or CURRENT_DATE.

    The exception is that you can specify CURRENT_TIMESTAMP as the default for a TIMESTAMP column.

    That’s why default 0 works (a constant) but default curdate() doesn’t (a function).

    You have (at least) a couple of possibilities to work around this.

    The first is to use a timestamp column instead of a date column, and set its default to CURRENT_TIMESTAMP. Unfortunately, that means you’ll have to turn that back into a date when extracting it.

    The second is to use triggers to set the column value, rather than from a default value. For example, use an insert trigger to set the relevant column to the current date.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanna encpryt a string with a key, using HmacSHA256. The code everyone use
Everyone in my office uses Macs and therefore most use Safari. We have a
Everyone who's done any web application development in Scala knows that you can use
everyone. I have an idea to use Activerecord to implement something strange like the
everyone knows that we are restricted to use the windows native fonts like arial,
Everyone use lot of List. I need to iterate over this list, so I
everyone the question is how to use options Show windows side by side by
everyone. I don't use jQuery. I create a script tag and append it to
everyone.I wanna include javascript in the html(webpy templates),but it doesn't work.the javascript code in
Greetings everyone, i just wanna ask.. how do i disable the right click property

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.