Scotters Blog
A place for me to record the useful things I find
Follow us on Twitter Follow us on Facebook Follow us on Instagram Follow us on LinkedIn
Skip to content
  • Home
  • About
    • Test Child
  • To do
  • Useful Software
  • Email Tools / Sites
  • Stolen Bikes

MySQL automatically set created and lastupdated timestamps on columns

By Stephen Scotter | October 1, 2015
0 Comment

ALTER TABLE `tablename`
ADD COLUMN `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
ADD COLUMN `updated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;

https://dev.mysql.com/doc/refman/5.6/en/timestamp-initialization.html

https://dev.mysql.com/doc/refman/5.6/en/data-type-defaults.html

Requires MySQL 5.6.5 or better

Category: MySQL
Post navigation
← Creating a Microsoft Office 365 Offline Installer Convert an SSL certificate from an Apache server to a Windows server →

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Tags

301 Active Directory ADSL amavisd apache British Telecom BT Bulb Model Car CentOS Delphi Draytek Fedora Fish Pie Ford FreeBSD fsmo Group Policy https Internet Keys Line Attenuation Linux Loop Att Loop Attenuation mk3 Mondeo netinstall NO NAT NONAT OpenSSH phplist Recipe redirect redirectio RRDTool SNR SSH ssl Time Upgrade

Categories

  • Cars
  • Computers
    • Anti Virus
    • Backup Exec
    • Coding Snipbits
    • Database
    • Debian
    • Delphi
    • FreeBSD
    • FreeNAS
    • Internet
    • Linux
    • Munin
    • Network
    • Owncloud
    • Programming
      • Git
      • SVN
      • VBA
    • Recommended Software
    • Software
      • Office
    • Virtualisation
    • Web Development
      • Apache
      • Awstats
      • MySQL
      • PHP
      • Wordpress
      • Yii
    • Wifi
    • Windows
      • Active Directory
      • Domain Administration
      • Exchange
      • Group Policy
      • Microsoft SQL
      • Terminal Services / Remote Desktop Services
      • Windows SBS
      • Windows Updates
      • WSUS
  • Food / Recipes
  • Mobile Phones
  • Random
  • To do
  • Uncategorized

Blogroll

  • Adobe Flash Check / Direct Download Link (20-04-2015)
  • Avoid tech support phone scams
  • http://www.mitec.cz/
  • http://www.ntcore.com/
  • Microsoft Safety Scanner
  • Spectrum Computer Solutions

Resource

  • Adobe Reader FTP
  • Al Iverson's Spam Resource
  • AppDeploy
  • B2BL: B2B spam
  • BT Broadband checker (backend)
  • Delphi Area
  • Download Test Files
  • elementiks.com/web_resources.php
  • Microsoft Drivers Catalog
  • Microsoft System Update Readiness Tool
  • Openreach – Superfast fibre broadband – Where and when
  • Soft Perfect – IP Scanners, Network Protocol Analyzer & LAN Search Pro
  • Spamassassin Tips
  • Sysinternals SyncTools
  • Talk Talk Service Status
  • Windows Update Repair
  • www.zytrax.com
custom footer text left
custom footer text right
Iconic One Theme | Powered by Wordpress