gpt4 book ai didi

mysql - 创建带有日期列的表

转载 作者:可可西里 更新时间:2023-11-01 06:42:50 24 4
gpt4 key购买 nike

我想创建一个包含“student_birthday”列的学生表,其格式应为 dd-mm-yy。

create table `student`.`studentinfo`(
`student_id` int(10) not null auto_increment,
`student_name` varchar(45) not null,
`student_surname` varchar(45) not null,
`student_birthday` date(???),
(some lines of code)
primary key(student_id));

应该在 (???) 中输入什么以获得上面的正确格式?

最佳答案

只需使用不带括号的“DATE”。只有某些列类型需要方括号,在这些列类型中您要指定可以存储的最大字节数/字符数。

对于 MySQL,它记录在 https://dev.mysql.com/doc/refman/5.7/en/date-and-time-types.html

关于mysql - 创建带有日期列的表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28041953/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com