Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Q4
--PostgreSQL 9.6 --'\\' is a delimiter CREATE TABLE spam (Name CHAR(20), Address CHAR(20), ID INTEGER, SameFam INTEGER); INSERT INTO spam(Name,Address,ID,SameFam) VALUES ('Alice','A',10,NULL), ('Bob','B',15,NULL), ('Carmen','C',22,NULL), ('Diego','A',9,10), ('Ella','B',3,15), ('Frankhad','D',11,NULL) ; CREATE TABLE table3 AS SELECT Name as name1,Address as Address1,ID as ID1,SameFam as SameFam1 From spam WHERE SameFam IS NULL; CREATE TABLE table4 AS SELECT Name as name2,Address,ID,SameFam From spam WHERE SameFam IS NOT NULL; SELECT * FROM spam; DELETE FROM spam WHERE name in (SELECT name1 FROM table3 INNER JOIN table4 ON table3.id1 = table4.SameFam ORDER BY NAME); SELECT * FROM spam;
run
|
edit
|
history
|
help
0
Yy
SQL Practice Sample: Movie Database
Postgres Practice
Recursive inefficiency
Select all countries that can be found by recursively adding all neighbouring countries (PostgreSQL)
ds
pgsql trigger 01 - Ovocie
tic tac toe
avg with subquery
yordan