0
0
GraphQLquery~10 mins

Sorting arguments in GraphQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to sort users by their name in ascending order.

GraphQL
query { users(orderBy: [1]) { id name } }
Drag options to blanks, or click blank then click option'
Aname_DESC
Bname_ASC
Cid_ASC
Did_DESC
Attempts:
3 left
💡 Hint
Common Mistakes
Using DESC instead of ASC for ascending order.
Sorting by id instead of name.
2fill in blank
medium

Complete the code to sort products by price in descending order.

GraphQL
query { products(orderBy: [1]) { id price } }
Drag options to blanks, or click blank then click option'
Aprice_DESC
Bid_DESC
Cname_ASC
Dprice_ASC
Attempts:
3 left
💡 Hint
Common Mistakes
Using _ASC instead of _DESC for descending order.
Sorting by wrong field like id or name.
3fill in blank
hard

Fix the error in the sorting argument to sort posts by creation date ascending.

GraphQL
query { posts(orderBy: [1]) { id createdAt } }
Drag options to blanks, or click blank then click option'
AcreatedAt_DESC
Bdate_ASC
CcreatedAt_ASC
Dcreated_ASC
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect field names like date or created.
Using DESC instead of ASC.
4fill in blank
hard

Fill both blanks to sort comments by author name ascending and then by date descending.

GraphQL
query { comments(orderBy: [[1], [2]]) { id author date } }
Drag options to blanks, or click blank then click option'
Aauthor_ASC
Bauthor_DESC
Cdate_DESC
Ddate_ASC
Attempts:
3 left
💡 Hint
Common Mistakes
Reversing the order of sorting arguments.
Using DESC for author instead of ASC.
5fill in blank
hard

Fill all three blanks to sort orders by status descending, then by total ascending, and finally by date descending.

GraphQL
query { orders(orderBy: [[1], [2], [3]]) { id status total date } }
Drag options to blanks, or click blank then click option'
Astatus_DESC
Btotal_ASC
Cdate_DESC
Dstatus_ASC
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing ascending and descending orders incorrectly.
Using wrong field names or order directions.