Last active
July 1, 2022 02:14
-
-
Save mmyoji/298f8f520cb2c0b84445b81c63729a2e to your computer and use it in GitHub Desktop.
[SQLime] test relation query result
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
SELECT users.*, posts.* | |
FROM users | |
INNER JOIN posts ON posts.user_id = users.id; |
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
BEGIN TRANSACTION; | |
PRAGMA writable_schema=ON; | |
CREATE TABLE IF NOT EXISTS users ( | |
id integer primary key, | |
name varchar(255) NOT NULL | |
); | |
CREATE TABLE IF NOT EXISTS posts ( | |
id integer primary key, | |
user_id integer NOT NULL, | |
title varchar(255) NOT NULL | |
); | |
INSERT INTO "users" VALUES(1, "user-1"); | |
INSERT INTO "users" VALUES(2, "user-2"); | |
INSERT INTO "users" VALUES(3, "user-3"); | |
INSERT INTO "posts" VALUES(1, 1, "user-1-A"); | |
INSERT INTO "posts" VALUES(2, 2, "user-2-A"); | |
INSERT INTO "posts" VALUES(3, 3, "user-3-A"); | |
INSERT INTO "posts" VALUES(4, 1, "user-1-B"); | |
INSERT INTO "posts" VALUES(5, 2, "user-2-B"); | |
INSERT INTO "posts" VALUES(6, 2, "user-2-C"); | |
INSERT INTO "posts" VALUES(7, 3, "user-3-B"); | |
PRAGMA writable_schema=OFF; | |
COMMIT; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment