text stringlengths 0 5.52k |
|---|
Thought: The user wants to book a flight from New York to London. I need to check available flights first. |
Action: {"name": "search_flights", "arguments": {"origin": "JFK", "destination": "LHR", "departure_date": "2024-03-15", "return_date": "2024-03-22", "passengers": 1}} |
Observation: [{"flight_number": "BA178", "airline": "British Airways", "departure": "10:30", "arrival": "22:15", "price": 542}, {"flight_number": "AA734", "airline": "American Airlines", "departure": "14:15", "arrival": "06:45+1", "price": 618}] |
Thought: The user wants to send an email to their team. I'll use the send_email function. |
Action: {"name": "send_email", "arguments": {"to": ["alice@company.com", "bob@company.com"], "subject": "Q3 Planning Meeting", "body": "Hi team,\n\nPlease join our Q3 planning meeting on March 15th at 2 PM EST. We'll discuss roadmap priorities and resource allocation.\n\nBest regards,\nJohn"}} |
Observation: {"status": "sent", "message_id": "msg_abc123", "timestamp": "2024-03-10T14:32:15Z"} |
{"name": "create_project", "description": "Create a new project", "parameters": {"type": "object", "properties": {"name": {"type": "string"}, "description": {"type": "string"}, "owner_id": {"type": "integer"}, "deadline": {"type": "string", "format": "date"}, "tags": {"type": "array", "items": {"type": "string"}}}, "re... |
CREATE TABLE users ( |
id BIGINT PRIMARY KEY AUTO_INCREMENT, |
email VARCHAR(255) NOT NULL UNIQUE, |
password_hash VARCHAR(255) NOT NULL, |
first_name VARCHAR(100), |
last_name VARCHAR(100), |
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, |
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
is_active BOOLEAN DEFAULT TRUE, |
last_login TIMESTAMP NULL, |
INDEX idx_email (email), |
INDEX idx_created_at (created_at) |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
CREATE TABLE projects ( |
id BIGINT PRIMARY KEY AUTO_INCREMENT, |
name VARCHAR(200) NOT NULL, |
description TEXT, |
owner_id BIGINT NOT NULL, |
status ENUM('planning', 'active', 'on_hold', 'completed', 'cancelled') DEFAULT 'planning', |
start_date DATE, |
deadline DATE, |
budget DECIMAL(12,2), |
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, |
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
FOREIGN KEY (owner_id) REFERENCES users(id) ON DELETE RESTRICT, |
INDEX idx_owner (owner_id), |
INDEX idx_status (status), |
INDEX idx_deadline (deadline) |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
CREATE TABLE project_members ( |
project_id BIGINT NOT NULL, |
user_id BIGINT NOT NULL, |
role ENUM('owner', 'admin', 'member', 'viewer') DEFAULT 'member', |
joined_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, |
PRIMARY KEY (project_id, user_id), |
FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE, |
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
CREATE TABLE comments ( |
id BIGINT PRIMARY KEY AUTO_INCREMENT, |
task_id BIGINT NOT NULL, |
author_id BIGINT NOT NULL, |
content TEXT NOT NULL, |
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, |
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
FOREIGN KEY (task_id) REFERENCES tasks(id) ON DELETE CASCADE, |
FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE RESTRICT, |
INDEX idx_task (task_id), |
INDEX idx_author (author_id) |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
SELECT |
u.id, |
u.email, |
u.first_name, |
u.last_name, |
COUNT(DISTINCT p.id) AS project_count, |
COUNT(DISTINCT t.id) AS task_count, |
SUM(CASE WHEN t.status = 'done' THEN 1 ELSE 0 END) AS completed_tasks, |
AVG(t.actual_hours) AS avg_actual_hours |
FROM users u |
LEFT JOIN project_members pm ON u.id = pm.user_id |
LEFT JOIN projects p ON pm.project_id = p.id |
LEFT JOIN tasks t ON p.id = t.project_id AND t.assignee_id = u.id |
WHERE u.is_active = TRUE |
AND u.created_at >= '2023-01-01' |
GROUP BY u.id, u.email, u.first_name, u.last_name |
HAVING COUNT(DISTINCT p.id) > 0 |
ORDER BY project_count DESC, completed_tasks DESC |
LIMIT 50; |
SELECT |
u.email, |
COUNT(t.id) AS assigned_tasks, |
SUM(CASE WHEN t.status = 'done' THEN 1 ELSE 0 END) AS completed, |
ROUND(100.0 * SUM(CASE WHEN t.status = 'done' THEN 1 ELSE 0 END) / NULLIF(COUNT(t.id), 0), 2) AS completion_rate, |
SUM(t.actual_hours) AS total_hours_logged |
FROM users u |
JOIN tasks t ON u.id = t.assignee_id |
JOIN projects p ON t.project_id = p.id |
WHERE p.status = 'active' |
AND t.status IN ('in_progress', 'in_review', 'done') |
AND t.actual_hours IS NOT NULL |
GROUP BY u.id, u.email |
HAVING COUNT(t.id) >= 5 |
ORDER BY completion_rate ASC |
LIMIT 20; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.