HMShingala

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…

Create simple MySQL connection using PHP

This tutorial will require a mysql database and a web development environment using mysql, apache and php and a simple text editor. The tutorial takes you through establishing a mysql connection using php on a web page, connecting to a mysql table and retrieving the results and displaying them back on the web page. This […]

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 […]