PromptBase
Close icon
General
Home
Marketplace
Hire
Create
Login
Sell
Explore
πŸ€– GPT

Database Expert

Database Expert gpt prompt mini thumbnail
1.0Star icon
1 review
3Heart icon
Favorites
105Eye icon
Views
GPT-3.5-TURBO
TestedTick icon
πŸ”πŸ“Š Need help with SQL? Look no further! πŸ’‘πŸ’» 🎯 Answer SQL-related questions, or output standard SQL statements effortlessly with ChatGPT! πŸš€πŸ”’ ⚑️ Whether you're a beginner or a pro, our AI-powered model is here to simplify your SQL experience. πŸ’ͺ✨ πŸ’¬ Simply ask your SQL question with our prompts, and ChatGPT will provide you with accurate answers and generate standard SQL statements in a snap! πŸ“πŸ’¬ πŸ‘‰ Try ChatGPT now and witness the magic for yourself.
...more
$2.99
Get prompt
After purchasing, you will gain access to the prompt file which you can use with GPT or the app builder. You'll receive 20 free generation credits with this purchase. By purchasing this prompt, you agree to our terms of service.
Updated: Over 1 month ago

Prompt Details

Model
Chat - GPT-3.5 (gpt-3.5-turbo)
Token size
Example input
Question: "Write the SQL query to get the third maximum salary of an employee from a table named employees" Employee table employee_name salary A 24000 C 34000 D 55000 E 75000 F 21000 G 40000 H 50000
Example output
Sure, I can help with that! Here's the SQL query to retrieve the third highest salary from the "employees" table: sql SELECT salary FROM employees ORDER BY salary DESC LIMIT 1 OFFSET 2; This query first sorts the salaries in descending order using the ORDER BY clause. Then it uses the LIMIT and OFFSET clauses to skip the first two rows (i.e., the two highest salaries) and return the third highest salary. Note that if there are duplicate salaries, this query will return the third highest distinct salary. If you want to include ties, you can use the DENSE_RANK function instead. Here's an example query that uses DENSE_RANK: sql SELECT DISTINCT salary FROM employees WHERE DENSE_RANK() OVER (ORDER BY salary DESC) = 3; This query uses the DENSE_RANK window function to assign a rank to each salary, based on the descending order of salaries. It then filters the result set to include only the rows where the salary has a rank of 3 (i.e., the third highest salary, or the third highest salary in case of ties). The DISTINCT keyword is used to remove duplicates from the result set.
  • Reviews for this prompt (1)
- Jun 1, 2023
1.0
Filled star iconOutlined star iconOutlined star iconOutlined star iconOutlined star icon
- Verified PurchaseTick icon
"I can't believe I paid for this. I could have made my own prompt. "
Browse Marketplace