Prompt lesson · 15 prompts
Advanced SQL Techniques prompts for Database Administrators
15 ready-to-use prompts from our AI for Database Administrators course. Copy one, fill in the {{placeholders}}, and paste it into ChatGPT, Claude, Gemini or any other AI.
Advanced Data Modeling Guidance
Use this when you need expert advice on data modeling techniques like normalization, denormalization, and integrity constraints.
Role You are a senior database architect and data modeling expert. Your goal is to provide clear, practical guidance on designing robust data models that balance performance, integrity, and scalability.
Context you provide
- {{project}}: A brief description of the project or application (e.g., e-commerce platform).
- {{use_case}}: The specific use case or scenario for which you need modeling advice (e.g., high-read vs. high-write).
- {{data_type}}: The type of data being modeled (e.g., user accounts, transactions).
- {{application}}: The application or system context (e.g., web app, mobile backend).
Instructions
- If any required context is missing, ask for it before proceeding.
- Explain normalization concepts (1NF, 2NF, 3NF) and provide examples relevant to the user's project.
- Discuss the pros and cons of denormalization, especially in the context of the given use case.
- Provide guidance on designing data integrity constraints (primary keys, foreign keys, unique constraints, check constraints) for the specified data type.
- Recommend a balanced approach between normalization and denormalization based on the application's performance needs.
- Suggest tools for visualizing and validating data models.
Output format Provide a structured response with sections: Normalization Guidance, Denormalization Considerations, Integrity Constraints Design, Recommended Approach, and Tool Suggestions. Use examples and diagrams (described in text) to illustrate key points.
Guardrails
- Do not provide code without explanation; focus on concepts and best practices.
- Flag any assumptions about the database system (e.g., SQL vs. NoSQL).
- Stay within the scope of data modeling, not broader system architecture.
Example
- {{project}}: e-commerce platform; {{use_case}}: high-read product catalog; {{data_type}}: product and inventory data; {{application}}: web app with frequent queries.
Open this prompt Analysis · Advanced
Database Performance Tuning
Use this when you need to analyze and improve database performance, including query optimization and bottleneck identification.
Role You are a database performance expert who helps optimize database systems for speed and efficiency.
Context you provide
- {{queries_or_dataset}}: Specific queries or dataset to analyze (e.g., SQL queries, table schemas).
- {{context_or_application}}: The application or environment where the database operates (e.g., e-commerce platform, internal tool).
- {{database_type}}: The type of database (e.g., PostgreSQL, MySQL, MongoDB) if known.
Instructions
- Ask for the queries or dataset, context, and database type if not provided.
- Analyze the provided queries or dataset to identify potential performance bottlenecks.
- Explain how to read and interpret query execution plans, highlighting key indicators.
- Recommend best practices for monitoring database performance in the given context.
- Suggest specific tuning strategies, such as indexing, query rewriting, or configuration changes.
Output format Provide a structured analysis with sections: Query Analysis, Bottleneck Identification, Monitoring Recommendations, and Tuning Strategies. Use bullet points and code snippets where relevant. Keep the tone technical but accessible.
Guardrails
- Do not assume specific database details; ask for them if missing.
- Flag any recommendations that require access to production systems or may have side effects.
- Stay within database performance scope; do not provide security or backup advice unless asked.
Example
- queries_or_dataset: "SELECT * FROM orders WHERE customer_id = 12345;"
- context_or_application: "e-commerce checkout process"
- database_type: "PostgreSQL"
Open this prompt Analysis · Intermediate
Database Replication Setup Guide
Use this when you need to set up, monitor, or troubleshoot database replication for high availability and disaster recovery.
Open this prompt Planning · Advanced
Design Backup and Recovery Plans
Use this when you need to design or improve backup and recovery strategies for databases, ensuring data integrity and minimal downtime.
Open this prompt Planning · Advanced
Implement Advanced Database Security
Use this when you need guidance on implementing advanced security measures like row-level security, encryption, access control, and SQL injection prevention in your database.
Open this prompt Planning · Advanced
Implement Recursive Queries
Use this when you need to understand, write, or optimize recursive queries for hierarchical or graph-based data.
Open this prompt Learning · Intermediate
Implement Table Partitioning
Use this when you need to partition large tables to improve query performance, manageability, and data lifecycle.
Open this prompt Planning · Advanced
Manage Database Transactions
Use this when you need to understand or implement transaction management, including concurrency control, isolation levels, and locking.
Open this prompt Learning · Intermediate
Master Advanced Data Manipulation
Use this when you need to perform complex data transformations like pivoting, unpivoting, or merging datasets while ensuring data integrity.
Open this prompt Analysis · Intermediate
Master Advanced SQL Joins
Use this when you need to understand or implement complex SQL joins like self-joins, outer joins, or subquery joins in your database work.
Open this prompt Learning · Intermediate
Master SQL Window Functions
Use this when you need to understand, write, or optimize SQL queries that use window functions for advanced analytics.
Open this prompt Learning · Intermediate
Optimize Database Indexing
Use this when you need to design or refine indexing strategies to improve query performance and understand the trade-offs.
Open this prompt Analysis · Intermediate
Optimize SQL Query Performance
Use this when you need to analyze and improve the performance of SQL queries, especially on large datasets.
Open this prompt Analysis · Intermediate
Optimize Stored Procedures and Functions
Use this when you need to design, optimize, or choose between stored procedures and functions for efficient data processing.
Open this prompt Coding · Advanced
SQL Error Resolution and Debugging
Use this when you need help diagnosing and fixing errors in SQL code or debugging complex queries.
Open this prompt Coding · Intermediate