Please enable JavaScript.
Coggle requires JavaScript to display documents.
MySQL (Tip & Tick (SELECT DATE / TIME (select cast('2011-10-24 15…
MySQL
Tip & Tick
Random Update value :
UPDATE members SET position = ELT(FLOOR(RAND()*2)+1, 'Frontend Developer', 'Backend Developer');
Random Insert valule :
INSERT INTO
im
(
im
,
service
) SELECT LOWER(
last
), ELT(0.5 + RAND() * 6, 'AIM', 'ICQ', 'MSN', 'Yahoo', 'GTalk', 'Other') FROM
contact
ALTER TABLE
Tablel_name
CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
Custom Auto Increment
Create new user mysql
ALTER DATABASE
database_name
CHARACTER SET utf8 COLLATE utf8_general_ci;
SELECT DATE / TIME
select cast('2011-10-24 15:20:10' as time);
select cast('2011-10-24 15:20:10' as date);
SELECT 0-23 Hours
SELECT date of range
Issue
mysql-error-code-1175
:!?:
Change mysql root password
Cannot truncate a table referenced in a foreign key constraint
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE table1;
TRUNCATE table2;
SET FOREIGN_KEY_CHECKS = 1;
Don't add or update fk
SET GLOBAL FOREIGN_KEY_CHECKS=0;
SET FOREIGN_KEY_CHECKS=0;
Command
mysql -u root -p
Create schema :
create schema hws_test2 char set utf8 collate utf8_general_ci
Learning
SQL พื้นฐาน