Skip to main content
Database

Multiple Table Join

QueryValidateMedium

Description

Get order details with product names and user info.

Test Scenario

-- Your query:
SELECT u.name, p.name as product, oi.quantity, oi.unit_price
FROM orders o
JOIN users u ON o.user_id = u.id
JOIN order_items oi ON o.id = oi.order_id
JOIN products p ON oi.product_id = p.id;

-- Expected: All order items with context

Testing Tips

  • •Chain multiple JOINs
  • •Each JOIN connects two tables
  • •Use meaningful aliases
// 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-multi-join

2 frameworks available