Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
quiz 1
--PostgreSQL 9.6 --'\\' is a delimiter create table orders ( orderid int, item varchar(20)); insert into orders values ( 1, 'Fries' ), ( 1, 'Soda' ), ( 1, 'Burger'), ( 2, 'Fries' ), ( 2, 'Soda' ), ( 3, 'Burger'), ( 3, 'Fries' ), ( 4, 'Soda' ), ( 4, 'Burger'), ( 5, 'Fries' ), ( 5, 'Soda' ), ( 6, 'Burger'), ( 6, 'Popcorn'), ( 6, 'Soda' ), ( 6, 'Fries' ), ( 7, 'Fries' ), ( 7, 'Soda' ), ( 7, 'Burger'); /********* item item count 1 Fries Soda 5 2 Burger Fries 4 3 Burger Soda 4 4 Fries Popcorn 1 5 Popcorn Soda 1 6 Burger Popcorn 1 ********/ select o1.item, o2.item, count(*) from orders o1 join orders o2 on o1.orderid = o2.orderid and o1.item <> o2.item and o1.item < o2.item group by o1.item, o2.item order by count(*) desc
run
|
edit
|
history
|
help
0
postgres group by by function
SQL social network practice by Han Wang 20200720
Timestamps in PostgreSQL
Query integer in text field - Seemingly doesn't work as expected
test
Postgres CrossTab for query with variable number of columns
SQL - Social Network Analysis by Patrick Lin
Leet Code 185
select distinct
Recursive inefficiency