AKZN Notes

Archives for My Lazy and Forgetful Mind

Tag: mysql

How to import big table using mysql command on terminal

Understanding the MySQL Import Command with Custom Parameters When importing large SQL dump files into MySQL, it is often necessary to adjust MySQL’s configuration parameters to handle large queries and improve performance. The following command is an example of importing a database dump while customizing MySQL’s memory settings and disabling foreign key checks: "D:\xampp\mysql\bin\mysql" –max_allowed_packet=512M […]

RANDOM DATA Table Order

[MYSQL][PROCEDURE] RANDOM DATA Table Order tb_order DELIMITER $$ DROP PROCEDURE IF EXISTS make_order$$ CREATE PROCEDURE make_order () BEGIN DECLARE monthcounts INT DEFAULT 1; DECLARE daycounts INT DEFAULT 1; DECLARE orderbydaycounts INT DEFAULT 1; WHILE monthcounts < 9 DO SET daycounts = 1; WHILE daycounts < 31 DO SET orderbydaycounts = 1; WHILE orderbydaycounts < 5 […]

Generate Random Data Function with Mysql

Function Helper DROP FUNCTION IF EXISTS generate_fname; DELIMITER $$ CREATE FUNCTION generate_fname () RETURNS VARCHAR(255) BEGIN RETURN ELT(FLOOR(1 + (RAND() * (50-1))), "Deni","Desi","Dito","Femi","Hafid","Rizki","Utami","Aulia","Tika","Hadi","Bayu","Annisa","Retno","Fajar","Wulandari","Nurul","Rini","Ilham","Kusuma","Rizki","Dinda","Andre","Ari","Maria","Wahyu","Mila","Lia","Kartika","Indra","Eko","Kurniawan","Sari","Ajie","Sri","Tyas","Dian","Lestari","Maya","Ika","Arya","Yudi","Andy","Anthony","Siti","Rio","Sarah","Reza","Andi","Fitri","Nur","Ade","Agus","Tri","Indah","Dian","Putra","Muhammad","Dwi","Jeffrey","Melissa","Eric","Anna","Stephen","Andrew"); END$$ DELIMITER ; DROP FUNCTION IF EXISTS generate_lname; DELIMITER $$ CREATE FUNCTION generate_lname () RETURNS VARCHAR(255) BEGIN RETURN ELT(FLOOR(1 + (RAND() * (58-1))), "Bagaskoro","Bakti","Dewangga","Dharma","Danastri","Danurdara","Diajeng","Endaru","Endang","Elok","Erina","Estiana","Gadhing","Ganendra","Gardara","Martin","Gentala","Galih","Ganesh","Gibran","Guinandra","Gumelar","Gunawan","Guntur","Guritno","Gusti","Gahyaka","Gantari","Ihsan","Ismoyono","Indira","Intan","Isthika","Jamal","Janu","Jatmika","Jaya","Jenaka","Jenggala","Jumanta","Jumantara","Kamajaya","Karunia","Kawindra","Kresna","Garini","Gayatri","Gemani","Gemintang","Gempita","Ginanita","Hakim","Halim","Hamdan","Hanafi","Handaru","Hapsari","Hardana","Haribawa"); END$$ DELIMITER ; Example query SELECT generate_fname() AS […]