PromptBase
Upgrade
Close icon
General
Home
Marketplace
Create
Hire
Login
Chat
Sell
Explore

Prompt Details

Model
(gemini-3.1-pro)
Token size
209
Example input
[Database System]: PostgreSQL [Table Schema]: Employees (id, name, department_id, salary), Departments (id, name) [Goal/Question]: Find the top 3 highest paid employees in each department.
Example output
-- Using Window Function to rank employees by salary within each department WITH RankedEmployees AS ( SELECT e.name AS employee_name, e.salary, d.name AS department_name, DENSE_RANK() OVER (PARTITION BY e.department_id ORDER BY e.salary DESC) as rank FROM Employees e JOIN Departments d ON e.department_id = d.id ) SELECT department_name, employee_name, salary FROM RankedEmployees WHERE rank <= 3 ORDER BY department_name, rank;
♊️ Gemini

Complex Sql Query Architect

Add to Cart
Instant accessInstant access
Usage rightsCommercial use
Money-back guaranteeMoney‑back
By purchasing this prompt, you agree to our terms of service
GEMINI-3.1-PRO
Tested icon
Guide icon
4 examples icon
Free credits icon
Stop struggling with complex database queries. This prompt acts as a Senior Database Engineer, generating optimized, bug-free SQL queries for any database system (MySQL, PostgreSQL, Oracle, SQL Server). Whether you need complex JOINs, nested subqueries, or window functions, just describe your data structure and goal to get the perfect code instantly.
...more
Added over 1 month ago
Report
Browse Marketplace