
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
Set new delay time in a MySQL column
To set new delay time, use INTERVAL and update the column wth SETa clause and UPDATE command. Let us first create a table −
mysql> create table DemoTable ( DelayTime time ); Query OK, 0 rows affected (1.21 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values('11 :30 :10'); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable values('12 :40 :00'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('05 :45 :24'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values('09 :00 :10'); Query OK, 1 row affected (0.18 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+------------+ | DelayTime | +------------+ | 11 :30 :10 | | 12 :40 :00 | | 05 :45 :24 | | 09 :00 :10 | +------------+ 4 rows in set (0.00 sec)
Following is the query to set new delay time −
mysql> select date_add(DelayTime,interval 10 second) AS `NewDelayTime` from DemoTable;
This will produce the following output −
+--------------+ | NewDelayTime | +--------------+ | 11 :30 :20 | | 12 :40 :10 | | 05 :45 :34 | | 09 :00 :20 | +--------------+ 4 rows in set (0.00 sec)
- Related Articles
- Adding a new column with the current time as a default value in MySQL?
- How to add time in a MySQL column set with type DATETIME?
- Set the NULL values to 0 and display the entire column in a new column with MySQL SELECT
- How to set delay for MySQL trigger/procedure execution?
- Counting same strings in a new MySQL column?
- Add a new column and set values in it on the basis of conditions in MySQL?
- Set column charset in MySQL?
- Adding new column after a specific column and defining a default in MySQL?
- Generation of time delay in 8085
- How to set delay in android?
- How can I make a time delay in Python?
- Concatenate all the columns in a single new column with MySQL
- Set a delay for the CSS transition effect
- Return 0 in a new column when record is NULL in MySQL?
- Set ENUM in MySQL for column values

Advertisements