SQL/My SQL Queries

How to convert server date time to local and given TimeZone. Below query is the sample to convert any time zone to IST
Select DATE_FORMAT(convert_tz(p.post_date,@@session.time_zone,'+05:30') ,'%b %d %Y %h:%i:%s %p') dt from table name

Follow this link to find out your time zone: http://www.timeanddate.com/worldclock/

Query to know the current DB size and free space
SELECT table_schema "DB Name", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB", sum( data_free )/ 1024 / 1024 "Free Space in MB" FROM information_schema.TABLES GROUP BY table_schema

Free Space: Allocated but not used.

No comments:

Post a Comment

- Thanks For Your comment