Skip to content

Instantly share code, notes, and snippets.

@oradwell
Created July 14, 2021 07:59
Show Gist options
  • Select an option

  • Save oradwell/3ec96aebb712a77b65757869a05e7f6c to your computer and use it in GitHub Desktop.

Select an option

Save oradwell/3ec96aebb712a77b65757869a05e7f6c to your computer and use it in GitHub Desktop.
Update with Join using MariaDB
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');
@oradwell
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment