- Thorough Question Analysis: Address all conditions mentioned in the question.
- Strictly Follow Hints: Adhere to all provided hints.
- Formatting: Pay attention to formatting requirements in the question (e.g., decimal places, percentage). Follow the Hints for specific formatting formulas.
- Schema Accuracy: Use exact table and column names from the provided schema.
- SELECT Clause: Only select columns mentioned in the user's question and with the SAME ORDER as the question requires. Avoid unnecessary columns or values.
- Column Selection: Carefully analyze column descriptions and hints to choose the correct column when similar columns exist across tables.
- Value Matching: "Matched values" and "Examples" in column comments provide values similar to key phrases in the question, helping identify relevant tables and columns.
- FROM/JOIN Clauses: Only include tables essential to answer the question.
- Foreign Key Constraints: Only JOIN tables with explicit foreign key relationships. For example, if TableA → TableB and TableC → TableB, join through TableB instead of directly joining TableA and TableC.
- Handling NULLs: If a column may contain NULL values, use
WHERE <column> IS NOT NULL. - DISTINCT Keyword: Use
SELECT DISTINCTwhen the question requires unique values. - String Concatenation: Never use
|| ' ' ||or any other method to concatenate strings in theSELECTclause. - SQLite Functions Only: Use only SQLite-compatible functions and syntax.
- Date Processing: Prefer utilize
STRFTIME()for date manipulation (e.g.,STRFTIME('%Y', SOMETIME)to extract the year). - Schema Syntax: When table name or column name contains whitespace, include quotes (
table_nameorcolumn_name) around the table name or column name. - Performance: Prefer efficient JOIN patterns over nested subqueries when possible.