Posts

Showing posts with the label mysql

#19. MySQL date time related query

 select CONVERT_TZ(now(), '+00:00', '+05:30') as converted_datetime; # converted_datetime '2022-07-06 19:28:31' select now() as current_dt; # current_dt '2022-07-06 13:56:07' select CURDATE() as current_dt; # current_dt '2022-07-06' SELECT @@global.time_zone, @@session.time_zone; # @@global.time_zone, @@session.time_zone 'SYSTEM', 'SYSTEM' select timediff(now(),convert_tz(now(),@@session.time_zone,'+00:00')); # timediff(now(),convert_tz(now(),@@session.time_zone,'+00:00')) '10:00:00' select convert_tz(now(),@@session.time_zone,'+00:00'); # convert_tz(now(),@@session.time_zone,'+00:00') '2022-07-06 04:03:47' select @@session.time_zone; # @@session.time_zone 'SYSTEM' SELECT @@system_time_zone; # @@system_time_zone 'AEST' SELECT TIMEDIFF(NOW(), UTC_TIMESTAMP); # TIMEDIFF(NOW(), UTC_TIMESTAMP) '10:00:00' select UTC_TIMESTAMP; # UTC_TIMESTAMP '2022-07-06 04:07:...

#24. MySQL cheatsheet

MySQL cheatsheet sudo service mysql stop sudo service mysql start mysql -u root -p -h 198.11.12.12 machine_integration select code from stock sf where sf.code LIKE 'CO%S' limit 10; 'CONS' 'CONS' 'CONS' 'CONS' 'CONS' 'CONS' 'CONS' 'CONS'