SQL query : Delete data of particular time period using

To delete data of some fix date and time use below mention query in your code. DELETE FROM tbl_user WHERE date < DATE_SUB(NOW(), INTERVAL 7 DAY) In above query “INTERVAL 7 DAY” here you can set any number of days like 1, 2, 5 etc…

List of SQL queries

A list of commonly used MySQL queries to create and how to use database, create table, insert record, update record, delete record, select record, truncate table and drop table are given below. Create database: CREATE DATABASE test_database Create new table: CREATE TABLE user ( id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, firstname VARCHAR(30) NOT NULL, lastname […]