Database
Limit Results
QueryValidateEasy
Description
Get the top 3 most expensive products.
Test Scenario
-- Your query:
SELECT * FROM products ORDER BY price DESC LIMIT 3;
-- Expected: Laptop Pro, Mechanical Keyboard, Webcam HDTesting Tips
- •LIMIT restricts number of rows
- •Combine with ORDER BY for "top N"
- •Useful for pagination
// Playwright API Testing - Databaseimport { 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-limit
2 frameworks available