我有员工表,如下所述:
String result = // Text representing the value of our date-time object.
LocalTime.parse( // Class representing a time-of-day value without a date and without a time zone.
"03:30 PM" , // Your `String` input text.
DateTimeFormatter.ofPattern( // Define a formatting pattern to match your input text.
"hh:mm a" ,
Locale.US // `Locale` determines the human language and cultural norms used in localization. Needed here to translate the `AM` & `PM` value.
) // Returns a `DateTimeFormatter` object.
) // Return a `LocalTime` object.
.format( DateTimeFormatter.ofPattern("HH:mm") ) // Generate text in a specific format. Returns a `String` object.
;
我想将团队的类型从+-------------+-----------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+-----------------------+------+-----+---------+----------------+
| employee_id | int(16) unsigned | NO | PRI | NULL | auto_increment |
| first_name | varchar(20) | NO | | NULL | |
| last_name | varchar(20) | NO | | NULL | |
| team | varchar(20) | NO | | No Team | |
+-------------+-----------------------+------+-----+---------+----------------+
更改为varchar(20)
,而不会破坏表格中的数据。
我该怎么做?
答案 0 :(得分:0)
在这种情况下,你可以:
在这种特殊情况下,应该没有问题,因此您可以决定预防措施是否应该占主导地位。
答案 1 :(得分:0)
ALTER TABLE `employee` CHANGE team team VARCHAR(128) NOT NULL DEFAULT 'No Team';