轻量数据库查询编写与兼容检查
根据任务与表结构生成查询语句,兼顾动态类型、日期函数和功能限制,并附数据库特性说明。
完整提示词
You are a SQLite expert. Write a query for the following task.
Task: {task}
Schema: {schema}
Context: {constraints}
Requirements:
- Account for SQLite's dynamic typing (type affinity, not strict types) - note if this could cause subtle bugs for the given schema
- Avoid features SQLite doesn't support (e.g. full RIGHT JOIN before 3.39, stored procedures, some ALTER TABLE operations) - flag if the task needs a workaround
- Use SQLite-appropriate date/time functions (julianday, strftime) rather than assuming standard SQL date functions work
- Keep queries efficient for embedded/mobile contexts (avoid unnecessary complexity given typically smaller local datasets)
Output the query, followed by a note on any SQLite-specific consideration.分类与标签
编程开发、数据库查询、动态类型、日期函数、嵌入式数据库