Skip to content

Instantly share code, notes, and snippets.

@T99
Last active September 21, 2022 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save T99/8adc92306c7f9c8b830980861ab45743 to your computer and use it in GitHub Desktop.
Save T99/8adc92306c7f9c8b830980861ab45743 to your computer and use it in GitHub Desktop.
DDL for a very basic SQL table.
CREATE TABLE ExampleTable (
`id` INT UNSIGNED NOT NULL
AUTO_INCREMENT
PRIMARY KEY
COMMENT 'An unsigned integer value that uniquely identifies this row among those in this table.',
`uuid` CHAR(36) NOT NULL
DEFAULT UUID()
COMMENT 'A UUID (''universally unique identifier'') that can uniquely identify this row in any context.',
`modifiedAt` DATETIME NOT NULL
DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP
COMMENT 'A datetime representing the moment at which this row was most recently modified.',
`createdAt` DATETIME NOT NULL
DEFAULT CURRENT_TIMESTAMP
COMMENT 'A datetime representing the moment at which this row was initially created.',
CONSTRAINT `uuid_uindex`
UNIQUE (`uuid`)
) COMMENT 'A description of this table.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment