cfahlgren1 HF staff commited on
Commit
f98fee6
1 Parent(s): 20ece27

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +59 -29
README.md CHANGED
@@ -94,41 +94,71 @@ Here is the SQL query that answers the question: `{natural language question}`
94
  ### **Example Schemas**
95
 
96
  ```sql
97
- CREATE TABLE
98
- table_1_11545282_6 (
99
- "No." numeric,
100
- Nationality text,
101
- "Years for Jazz" text
102
- );
103
-
104
- CREATE TABLE
105
- table_2_17383560_1 (
106
- Pick numeric,
107
- Round numeric,
108
- Player text,
109
- "School/Club Team" text,
110
- Position text
111
- );
112
-
113
- CREATE TABLE
114
- table_1_10581768_2 (
115
- Institution text,
116
- Enrollment numeric,
117
- Nickname text,
118
- Founded numeric
119
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  ```
121
 
122
- **Question**: **What is the round of pick 63?**
123
  ```sql
124
- SELECT "Round" FROM table_2_17383560_1 WHERE Pick=63;
 
 
 
 
125
  ```
126
- **Question**: **What is the most popular position among players?**
127
  ```sql
128
- SELECT COUNT("Position") FROM "table_2_17383560_1" GROUP BY "Position" ORDER BY COUNT("Position") DESC LIMIT 1;
 
 
 
 
 
 
129
  ```
130
 
131
- **Question**: **What is the most recent year an institution was founded?**
132
  ```sql
133
- SELECT MAX("Founded") FROM table_1_10581768_2;
 
 
 
134
  ```
 
94
  ### **Example Schemas**
95
 
96
  ```sql
97
+ CREATE TABLE users (
98
+ user_id SERIAL PRIMARY KEY,
99
+ username VARCHAR(50) NOT NULL,
100
+ email VARCHAR(100) NOT NULL,
101
+ password_hash TEXT NOT NULL,
102
+ created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
103
+ );
104
+
105
+ CREATE TABLE projects (
106
+ project_id SERIAL PRIMARY KEY,
107
+ project_name VARCHAR(100) NOT NULL,
108
+ description TEXT,
109
+ start_date DATE,
110
+ end_date DATE,
111
+ owner_id INTEGER REFERENCES users(user_id)
112
+ );
113
+
114
+ CREATE TABLE tasks (
115
+ task_id SERIAL PRIMARY KEY,
116
+ task_name VARCHAR(100) NOT NULL,
117
+ description TEXT,
118
+ due_date DATE,
119
+ status VARCHAR(50),
120
+ project_id INTEGER REFERENCES projects(project_id)
121
+ );
122
+
123
+ CREATE TABLE taskassignments (
124
+ assignment_id SERIAL PRIMARY KEY,
125
+ task_id INTEGER REFERENCES tasks(task_id),
126
+ user_id INTEGER REFERENCES users(user_id),
127
+ assigned_date DATE NOT NULL DEFAULT CURRENT_TIMESTAMP
128
+ );
129
+
130
+ CREATE TABLE comments (
131
+ comment_id SERIAL PRIMARY KEY,
132
+ content TEXT NOT NULL,
133
+ created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
134
+ task_id INTEGER REFERENCES tasks(task_id),
135
+ user_id INTEGER REFERENCES users(user_id)
136
+ );
137
  ```
138
 
139
+ **Question**: **Show me the day with the most users joining**
140
  ```sql
141
+ SELECT created_at::DATE AS day, COUNT(*) AS user_count
142
+ FROM users
143
+ GROUP BY day
144
+ ORDER BY user_count DESC
145
+ LIMIT 1;
146
  ```
147
+ **Question**: **Show me the project that has a task with the most comments**
148
  ```sql
149
+ SELECT p.project_name, t.task_name, COUNT(c.comment_id) AS comment_count
150
+ FROM projects p
151
+ JOIN tasks t ON p.project_id = t.project_id
152
+ JOIN comments c ON t.task_id = c.task_id
153
+ GROUP BY p.project_name, t.task_name
154
+ ORDER BY comment_count DESC
155
+ LIMIT 1;
156
  ```
157
 
158
+ **Question**: **What is the ratio of users with gmail addresses vs without?**
159
  ```sql
160
+ SELECT
161
+ SUM(CASE WHEN email ILIKE '%@gmail.com%' THEN 1 ELSE 0 END)::FLOAT / NULLIF(SUM(CASE WHEN email NOT ILIKE '%@gmail.com%' THEN 1 ELSE 0 END), 0) AS gmail_ratio
162
+ FROM
163
+ users;
164
  ```