Created
August 27, 2021 12:52
-
-
Save kastaneda/0aae5469848784010159ef9cb9446165 to your computer and use it in GitHub Desktop.
Hi there
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE foo1 (id int(10) UNSIGNED NOT NULL, msg varchar(20) NOT NULL); | |
ALTER TABLE foo1 ADD PRIMARY KEY (id); | |
INSERT INTO foo1 (id, msg) VALUES (1, 'foo'), (2, 'bar'); | |
/* | |
MariaDB [sandbox]> SELECT * FROM `foo1`; | |
+----+-----+ | |
| id | msg | | |
+----+-----+ | |
| 1 | foo | | |
| 2 | bar | | |
+----+-----+ | |
*/ | |
ALTER TABLE foo1 ADD xxx VARCHAR(20) NULL DEFAULT NULL, ADD UNIQUE (xxx); | |
/* | |
MariaDB [sandbox]> SELECT * FROM `foo1`; | |
+----+-----+------+ | |
| id | msg | xxx | | |
+----+-----+------+ | |
| 1 | foo | NULL | | |
| 2 | bar | NULL | | |
+----+-----+------+ | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment