Skip to content
Advertisement

How to convert a query into a nested query

How do I change this query into a nested query? The query and tables are listed below.

tables goes as follows

Nation : N_NATIONKEY, N_NAME

Supplier : S_SUPPKEY, S_NAME, S_NATIONKEY

Customer : C_CUSTKEY, C_NAME, C_NATIONKEY

Orders: O_ORDERKEY, O_CUSTKEY

Lineitem: L_ORDERKEY, L_SUPPKEY, L_QUANTITY, L_EXTENDEDPRICE, L_DISCOUNT

Advertisement

Answer

I’m not sure exactly what kind of nested join you’re looking for, but here is one option:

I haven’t tested it but give it a try and see if it works. If it doesn’t give you what you want, please post some sample data.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement