Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The field clock_out of attendance should be set a default value #1

Open
littleLi-star7 opened this issue Apr 23, 2022 · 2 comments
Open

Comments

@littleLi-star7
Copy link

image
when i create the attendance table the error occured , it hinted that the clock_out field should be set a default value,when i set a default value , it succeed .
image
mysql version is 8.0.18 . I want to know why it occured ,can you help me?
the script is SQL案例分析-员工考勤记录

@dongxuyang1985
Copy link
Owner

I test with MySQL 8.0.27, without this issue.

The error 1067 means clock_out has an invalid defualt value, but the script doesn't set it.
does it has NO_ZERO_IN_DATE,NO_ZERO_DATE in sql_mode?
the first timestamp (without NULL or DEFAULT) will automatically has DEFAULT CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP, but other timestamp (without NULL or DEFAULT) will automatically has DEFAULT ‘0000-00-00 00:00:00’, will break the NO_ZERO_IN_DATE,NO_ZERO_DATE rule, and raise 10067 error.

This should be an Mysql bug, so it's fixed in new version.

@littleLi-star7
Copy link
Author

image
thanks sql_mode has NO_ZERO_IN_DATE,NO_ZERO_DATE and i know why

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants