-
Notifications
You must be signed in to change notification settings - Fork 0
有用的mysql 语句
fubd edited this page Mar 16, 2023
·
1 revision
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `batchInsert2`(in args int)
begin
declare i int default 1;
start transaction;
while i <= args do
insert into user(`nickname`) value(concat("penguin-",i));
set i = i+ 1;
end while;
commit;
end;;
DELIMITER ;
call batchInsert2(1000000)
ALTER TABLE user CHANGE updated_at updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
ALTER TABLE user MODIFY created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL