Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
38 lines (32 loc) · 965 Bytes

File metadata and controls

38 lines (32 loc) · 965 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
DROP VIEW IF EXISTS joined;
DROP VIEW IF EXISTS toyotas;
DROP TABLE IF EXISTS "public"."make";
DROP TABLE IF EXISTS "public"."cars";
CREATE TABLE "public"."cars" (
id SERIAL PRIMARY KEY,
type TEXT,
model TEXT,
cost INT,
make_id INT
);
INSERT INTO "public"."cars" ("type", "model", "cost", "make_id") VALUES
('sedan', 'roadster', '33', '2'),
('sedan', 'prius', '22', '1'),
('sedan', 'focus', '18', '3'),
('suv', 'highlander', '40', '1');
CREATE TABLE "public"."make" (
id SERIAL PRIMARY KEY,
name TEXT
);
INSERT INTO "public"."make" ("name") VALUES ('toyota'), ('tesla'), ('ford');
CREATE VIEW joined AS
SELECT cars.type, cars.cost, cars.model, make.name
FROM cars
INNER JOIN make ON (cars.make_id = make.id)
ORDER BY cost DESC LIMIT 30;
CREATE VIEW toyotas AS
SELECT cars.type, cars.cost, cars.model, make.name
FROM cars
INNER JOIN make ON (cars.make_id = make.id)
WHERE make.name = 'toyota'
ORDER BY cost DESC LIMIT 30;
Morty Proxy This is a proxified and sanitized view of the page, visit original site.