SQL Queries – Cheat Sheat

Published on Author gryzliLeave a comment

Here I will write down some frequently used SQL examples , which I happen to search for again and again.

 

SELECT records from date column before or after a given DAYS

Select all records from a table “some_table” from MORE THANĀ 30 DAYS

 

 

 

 

 

Check mysql users CPU usage

 

Working with Tables

Check MySQL table / tables properties

 

Copy / Duplicate mysql table structure

Suppose you have mysql table called “original_table” and you want to make a copy of it. Here’s the SQL needed:

CREATE TABLE copy_table LIKE original_table;

 

And if you like also to copy the content of the table:

INSERT copy_table SELECT FROM original_table;

Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha * Time limit is exhausted. Please reload CAPTCHA.