Created
July 14, 2021 07:59
-
-
Save oradwell/3ec96aebb712a77b65757869a05e7f6c to your computer and use it in GitHub Desktop.
Update with Join using MariaDB
This file contains hidden or 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 user ( | |
| id INT(10) UNSIGNED PRIMARY KEY, | |
| name VARCHAR(128) NOT NULL, | |
| email VARCHAR(128) NOT NULL, | |
| country_code CHAR(2) DEFAULT NULL, | |
| country_name VARCHAR(60) DEFAULT NULL | |
| ); | |
| CREATE TABLE country ( | |
| id INT(10) UNSIGNED PRIMARY KEY, | |
| code CHAR(2) NOT NULL, | |
| name VARCHAR(60) NOT NULL | |
| ); | |
| CREATE TABLE login ( | |
| id INT(10) UNSIGNED PRIMARY KEY, | |
| email VARCHAR(128) NOT NULL, | |
| country_name VARCHAR(60) DEFAULT NULL | |
| ); | |
| INSERT INTO user VALUES (3, 'Jonh', '[email protected]', 'CC', NULL); | |
| INSERT INTO login VALUES (1, '[email protected]', NULL); | |
| INSERT INTO country VALUES (1, 'CC', 'Comic Comune'); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Explained on https://blog.radwell.codes/2021/07/update-statements-with-joins-on-mariadb/