Skip to main content
Database

Sort Results

QueryValidateEasy

Description

List all products sorted by price (highest first).

Test Scenario

-- Your query:
SELECT * FROM products ORDER BY price DESC;

-- Expected: Products sorted from $1299.99 to $19.99

Testing Tips

  • •ORDER BY sorts results
  • •DESC for descending (high to low)
  • •ASC for ascending (default)
// Playwright API Testing - Database
import { test, expect } from '@playwright/test';
test('Database query via API', async ({ request }) => {
const response = await request.post('/api/database/query', {
data: {
sql: 'SELECT * FROM users WHERE id = ?',
params: [1]
}
});
expect(response.ok()).toBeTruthy();
const { rows } = await response.json();
expect(rows.length).toBeGreaterThan(0);
});

Challenge ID: sql-order-by

2 frameworks available