Back

Explore Courses Blog Tutorials Interview Questions
0 votes
4 views
in SQL by (6.1k points)

In MySQL, Is there any command or value like DATETIME which I can use it in a manual query for inserting the current date and time?

INSERT INTO servers (
  server_name, online_status, exchange, disk_space, network_shares
) VALUES(
  'm1', 'ONLINE', 'ONLINE', '100GB', 'ONLINE' 'DATETIME' 
)

I need to add the current date and time in the quoted DATETIME value at the ending 

1 Answer

0 votes
by (12.7k points)
edited by

For adding current date and time, you can use NOW():

INSERT INTO servers (server_name, online_status, exchange, disk_space, network_shares, c_time)
VALUES('m1', 'ONLINE', 'exchange', 'disk_space', 'network_shares', NOW())

Want to know more about SQL? Join this SQL Course by Intellipaat.

For more details on MySQL, refer to the below MySQL Tutorial video. 

Related questions

0 votes
1 answer
asked Jul 19, 2019 in SQL by Tech4ever (20.3k points)
0 votes
1 answer
asked Jul 19, 2019 in SQL by Tech4ever (20.3k points)
0 votes
1 answer
0 votes
1 answer
asked Jan 5, 2021 in SQL by Appu (6.1k points)
0 votes
1 answer
asked Nov 23, 2020 in SQL by Appu (6.1k points)

Browse Categories

...