File size: 18,816 Bytes
fc8480f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | SQL Query,Description,text
SELECT * FROM Customers WHERE Country = 'USA';,Retrieve all customers from the USA.,"###Human:
Retrieve all customers from the USA.
###Assistant:
SELECT * FROM Customers WHERE Country = 'USA';"
"SELECT ProductName, Price FROM Products WHERE Category = 'Electronics';",Get the names and prices of products in the Electronics category.,"###Human:
Get the names and prices of products in the Electronics category.
###Assistant:
SELECT ProductName, Price FROM Products WHERE Category = 'Electronics';"
SELECT AVG(Age) FROM Employees;,Calculate the average age of all employees.,"###Human:
Calculate the average age of all employees.
###Assistant:
SELECT AVG(Age) FROM Employees;"
SELECT COUNT(*) FROM Orders WHERE ShipCountry = 'Germany';,Count the number of orders shipped to Germany.,"###Human:
Count the number of orders shipped to Germany.
###Assistant:
SELECT COUNT(*) FROM Orders WHERE ShipCountry = 'Germany';"
"SELECT FirstName, LastName, Salary FROM Employees WHERE Salary > 50000;","Fetch first name, last name, and salary of employees earning over $50,000.","###Human:
Fetch first name, last name, and salary of employees earning over $50,000.
###Assistant:
SELECT FirstName, LastName, Salary FROM Employees WHERE Salary > 50000;"
"SELECT Category, MAX(Price) FROM Products GROUP BY Category;",Find the highest price for each product category.,"###Human:
Find the highest price for each product category.
###Assistant:
SELECT Category, MAX(Price) FROM Products GROUP BY Category;"
UPDATE Customers SET City = 'New York' WHERE Country = 'USA';,Update the city of all USA customers to 'New York'.,"###Human:
Update the city of all USA customers to 'New York'.
###Assistant:
UPDATE Customers SET City = 'New York' WHERE Country = 'USA';"
DELETE FROM Orders WHERE OrderDate < '2023-01-01';,"Delete orders placed before January 1, 2023.","###Human:
Delete orders placed before January 1, 2023.
###Assistant:
DELETE FROM Orders WHERE OrderDate < '2023-01-01';"
"INSERT INTO Products (ProductName, Price, Category) VALUES ('Smartphone', 599, 'Electronics');",Insert a new product 'Smartphone' with price $599 into the Electronics category.,"###Human:
Insert a new product 'Smartphone' with price $599 into the Electronics category.
###Assistant:
INSERT INTO Products (ProductName, Price, Category) VALUES ('Smartphone', 599, 'Electronics');"
SELECT DISTINCT Country FROM Customers;,Retrieve a list of unique countries from the Customers table.,"###Human:
Retrieve a list of unique countries from the Customers table.
###Assistant:
SELECT DISTINCT Country FROM Customers;"
"SELECT OrderID, COUNT(ProductID) FROM OrderDetails GROUP BY OrderID HAVING COUNT(ProductID) > 5;",Get the order IDs with more than 5 products in the OrderDetails table.,"###Human:
Get the order IDs with more than 5 products in the OrderDetails table.
###Assistant:
SELECT OrderID, COUNT(ProductID) FROM OrderDetails GROUP BY OrderID HAVING COUNT(ProductID) > 5;"
"SELECT LastName, FirstName FROM Employees ORDER BY LastName ASC, FirstName ASC;","Retrieve employees' last names and first names, sorted alphabetically by last name and then first name.","###Human:
Retrieve employees' last names and first names, sorted alphabetically by last name and then first name.
###Assistant:
SELECT LastName, FirstName FROM Employees ORDER BY LastName ASC, FirstName ASC;"
SELECT ProductName FROM Products WHERE Price BETWEEN 50 AND 100;,Find product names with prices between $50 and $100.,"###Human:
Find product names with prices between $50 and $100.
###Assistant:
SELECT ProductName FROM Products WHERE Price BETWEEN 50 AND 100;"
"SELECT Category, COUNT(*) FROM Products GROUP BY Category ORDER BY COUNT(*) DESC;","List product categories and their counts, ordered by count in descending order.","###Human:
List product categories and their counts, ordered by count in descending order.
###Assistant:
SELECT Category, COUNT(*) FROM Products GROUP BY Category ORDER BY COUNT(*) DESC;"
"SELECT CustomerName, COUNT(OrderID) FROM Customers LEFT JOIN Orders ON Customers.CustomerID = Orders.CustomerID GROUP BY CustomerName;","Count the number of orders for each customer, including customers with zero orders.","###Human:
Count the number of orders for each customer, including customers with zero orders.
###Assistant:
SELECT CustomerName, COUNT(OrderID) FROM Customers LEFT JOIN Orders ON Customers.CustomerID = Orders.CustomerID GROUP BY CustomerName;"
SELECT ProductName FROM Products WHERE Price BETWEEN 50 AND 100;,Find product names with prices between $50 and $100.,"###Human:
Find product names with prices between $50 and $100.
###Assistant:
SELECT ProductName FROM Products WHERE Price BETWEEN 50 AND 100;"
"SELECT Category, COUNT(*) FROM Products GROUP BY Category ORDER BY COUNT(*) DESC;","List product categories and their counts, ordered by count in descending order.","###Human:
List product categories and their counts, ordered by count in descending order.
###Assistant:
SELECT Category, COUNT(*) FROM Products GROUP BY Category ORDER BY COUNT(*) DESC;"
"SELECT CustomerName, COUNT(OrderID) FROM Customers LEFT JOIN Orders ON Customers.CustomerID = Orders.CustomerID GROUP BY CustomerName;","Count the number of orders for each customer, including customers with zero orders.","###Human:
Count the number of orders for each customer, including customers with zero orders.
###Assistant:
SELECT CustomerName, COUNT(OrderID) FROM Customers LEFT JOIN Orders ON Customers.CustomerID = Orders.CustomerID GROUP BY CustomerName;"
"SELECT CustomerName, OrderDate FROM Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID WHERE Country = 'France';",Retrieve customer names and order dates for orders from customers in France.,"###Human:
Retrieve customer names and order dates for orders from customers in France.
###Assistant:
SELECT CustomerName, OrderDate FROM Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID WHERE Country = 'France';"
SELECT * FROM employees WHERE department = 'Sales';,Retrieve all employees from the 'Sales' department.,"###Human:
Retrieve all employees from the 'Sales' department.
###Assistant:
SELECT * FROM employees WHERE department = 'Sales';"
"SELECT product_name, price FROM products WHERE price > 100;",Get the names and prices of products that cost more than $100.,"###Human:
Get the names and prices of products that cost more than $100.
###Assistant:
SELECT product_name, price FROM products WHERE price > 100;"
"SELECT customer_id, COUNT(order_id) AS order_count FROM orders GROUP BY customer_id;",Count the number of orders for each customer.,"###Human:
Count the number of orders for each customer.
###Assistant:
SELECT customer_id, COUNT(order_id) AS order_count FROM orders GROUP BY customer_id;"
"SELECT customers.customer_name, orders.order_date FROM customers JOIN orders ON customers.customer_id = orders.customer_id;",Retrieve customer names and their order dates using a table join.,"###Human:
Retrieve customer names and their order dates using a table join.
###Assistant:
SELECT customers.customer_name, orders.order_date FROM customers JOIN orders ON customers.customer_id = orders.customer_id;"
"SELECT department, AVG(salary) AS average_salary FROM employees GROUP BY department;",Calculate the average salary for each department.,"###Human:
Calculate the average salary for each department.
###Assistant:
SELECT department, AVG(salary) AS average_salary FROM employees GROUP BY department;"
"SELECT product_name, price FROM products ORDER BY price DESC LIMIT 1;",Find the product with the highest price.,"###Human:
Find the product with the highest price.
###Assistant:
SELECT product_name, price FROM products ORDER BY price DESC LIMIT 1;"
"SELECT order_id, SUM(price * quantity) AS total_revenue FROM order_items GROUP BY order_id;",Calculate the total revenue for each order from the order items.,"###Human:
Calculate the total revenue for each order from the order items.
###Assistant:
SELECT order_id, SUM(price * quantity) AS total_revenue FROM order_items GROUP BY order_id;"
SELECT * FROM customers WHERE email IS NOT NULL;,Retrieve customers with non-null email addresses.,"###Human:
Retrieve customers with non-null email addresses.
###Assistant:
SELECT * FROM customers WHERE email IS NOT NULL;"
"SELECT product_name, category, price FROM products ORDER BY category, price;",Sort products by category and within each category by price.,"###Human:
Sort products by category and within each category by price.
###Assistant:
SELECT product_name, category, price FROM products ORDER BY category, price;"
SELECT product_name FROM products WHERE category_id IN (SELECT category_id FROM categories WHERE category_name = 'Electronics');,Retrieve product names from the 'Electronics' category using a subquery.,"###Human:
Retrieve product names from the 'Electronics' category using a subquery.
###Assistant:
SELECT product_name FROM products WHERE category_id IN (SELECT category_id FROM categories WHERE category_name = 'Electronics');"
UPDATE employees SET salary = salary * 1.1 WHERE department = 'Sales';,Increase the salary by 10% for all employees in the 'Sales' department.,"###Human:
Increase the salary by 10% for all employees in the 'Sales' department.
###Assistant:
UPDATE employees SET salary = salary * 1.1 WHERE department = 'Sales';"
DELETE FROM products WHERE stock_quantity <= 10;,Delete products with stock quantity less than or equal to 10.,"###Human:
Delete products with stock quantity less than or equal to 10.
###Assistant:
DELETE FROM products WHERE stock_quantity <= 10;"
"SELECT customers.customer_name, orders.order_date FROM customers LEFT JOIN orders ON customers.customer_id = orders.customer_id;",Retrieve customer names and their order dates using a LEFT JOIN.,"###Human:
Retrieve customer names and their order dates using a LEFT JOIN.
###Assistant:
SELECT customers.customer_name, orders.order_date FROM customers LEFT JOIN orders ON customers.customer_id = orders.customer_id;"
UPDATE orders SET status = 'Shipped' WHERE order_date < '2023-01-01';,"Update the status to 'Shipped' for orders placed before January 1, 2023.","###Human:
Update the status to 'Shipped' for orders placed before January 1, 2023.
###Assistant:
UPDATE orders SET status = 'Shipped' WHERE order_date < '2023-01-01';"
DELETE FROM employees WHERE hire_date < '2020-01-01';,"Delete employees hired before January 1, 2020.","###Human:
Delete employees hired before January 1, 2020.
###Assistant:
DELETE FROM employees WHERE hire_date < '2020-01-01';"
"SELECT customers.customer_name, COUNT(orders.order_id) AS order_count FROM customers LEFT JOIN orders ON customers.customer_id = orders.customer_id GROUP BY customers.customer_name;","Count the number of orders for each customer, even those without orders.","###Human:
Count the number of orders for each customer, even those without orders.
###Assistant:
SELECT customers.customer_name, COUNT(orders.order_id) AS order_count FROM customers LEFT JOIN orders ON customers.customer_id = orders.customer_id GROUP BY customers.customer_name;"
UPDATE products SET price = price * 0.9 WHERE category = 'Electronics';,Apply a 10% discount on prices for products in the 'Electronics' category.,"###Human:
Apply a 10% discount on prices for products in the 'Electronics' category.
###Assistant:
UPDATE products SET price = price * 0.9 WHERE category = 'Electronics';"
DELETE FROM categories WHERE category_name = 'Obsolete';,Delete the 'Obsolete' category from the categories table.,"###Human:
Delete the 'Obsolete' category from the categories table.
###Assistant:
DELETE FROM categories WHERE category_name = 'Obsolete';"
"SELECT employees.employee_name, departments.department_name FROM employees INNER JOIN departments ON employees.department_id = departments.department_id;",Retrieve employee names and their department names using an INNER JOIN.,"###Human:
Retrieve employee names and their department names using an INNER JOIN.
###Assistant:
SELECT employees.employee_name, departments.department_name FROM employees INNER JOIN departments ON employees.department_id = departments.department_id;"
UPDATE customers SET last_purchase_date = '2023-07-31' WHERE last_purchase_date IS NULL;,"Set the last purchase date to July 31, 2023, for customers with no previous purchase date.","###Human:
Set the last purchase date to July 31, 2023, for customers with no previous purchase date.
###Assistant:
UPDATE customers SET last_purchase_date = '2023-07-31' WHERE last_purchase_date IS NULL;"
UPDATE servers SET status = 'online' WHERE environment = 'production';,Change the status of servers in the 'production' environment to 'online'.,"###Human:
Change the status of servers in the 'production' environment to 'online'.
###Assistant:
UPDATE servers SET status = 'online' WHERE environment = 'production';"
DELETE FROM applications WHERE last_deployed < '2023-01-01';,"Delete applications that were last deployed before January 1, 2023.","###Human:
Delete applications that were last deployed before January 1, 2023.
###Assistant:
DELETE FROM applications WHERE last_deployed < '2023-01-01';"
"SELECT server_name, COUNT(*) AS instance_count FROM instances GROUP BY server_name;",Count the number of instances running on each server.,"###Human:
Count the number of instances running on each server.
###Assistant:
SELECT server_name, COUNT(*) AS instance_count FROM instances GROUP BY server_name;"
UPDATE databases SET backup_enabled = 1 WHERE environment = 'staging';,Enable database backups for databases in the 'staging' environment.,"###Human:
Enable database backups for databases in the 'staging' environment.
###Assistant:
UPDATE databases SET backup_enabled = 1 WHERE environment = 'staging';"
DELETE FROM containers WHERE resource_utilization > 90;,Delete containers with resource utilization over 90%.,"###Human:
Delete containers with resource utilization over 90%.
###Assistant:
DELETE FROM containers WHERE resource_utilization > 90;"
"SELECT application_name, SUM(response_time) AS total_response_time FROM logs GROUP BY application_name;",Calculate the total response time for each application from log data.,"###Human:
Calculate the total response time for each application from log data.
###Assistant:
SELECT application_name, SUM(response_time) AS total_response_time FROM logs GROUP BY application_name;"
UPDATE load_balancers SET active = 0 WHERE traffic_threshold > 80;,Deactivate load balancers with a traffic threshold higher than 80%.,"###Human:
Deactivate load balancers with a traffic threshold higher than 80%.
###Assistant:
UPDATE load_balancers SET active = 0 WHERE traffic_threshold > 80;"
DELETE FROM deployments WHERE deployment_date < '2023-03-01';,"Remove deployment records that are dated before March 1, 2023.","###Human:
Remove deployment records that are dated before March 1, 2023.
###Assistant:
DELETE FROM deployments WHERE deployment_date < '2023-03-01';"
"SELECT server_name, COUNT(*) AS error_count FROM logs WHERE log_level = 'error' GROUP BY server_name;",Count the number of error logs on each server.,"###Human:
Count the number of error logs on each server.
###Assistant:
SELECT server_name, COUNT(*) AS error_count FROM logs WHERE log_level = 'error' GROUP BY server_name;"
UPDATE environments SET auto_scaling = 1 WHERE usage > 70;,Enable auto-scaling for environments with usage over 70%.,"###Human:
Enable auto-scaling for environments with usage over 70%.
###Assistant:
UPDATE environments SET auto_scaling = 1 WHERE usage > 70;"
UPDATE servers SET maintenance_mode = 1 WHERE environment = 'development';,Activate maintenance mode for servers in the 'development' environment.,"###Human:
Activate maintenance mode for servers in the 'development' environment.
###Assistant:
UPDATE servers SET maintenance_mode = 1 WHERE environment = 'development';"
DELETE FROM backup_jobs WHERE completion_date < '2023-01-01';,"Remove backup jobs that were completed before January 1, 2023.","###Human:
Remove backup jobs that were completed before January 1, 2023.
###Assistant:
DELETE FROM backup_jobs WHERE completion_date < '2023-01-01';"
"SELECT app_name, AVG(response_time) AS average_response_time FROM app_logs GROUP BY app_name;",Calculate the average response time for each application from log data.,"###Human:
Calculate the average response time for each application from log data.
###Assistant:
SELECT app_name, AVG(response_time) AS average_response_time FROM app_logs GROUP BY app_name;"
UPDATE database_clusters SET replication_enabled = 1 WHERE environment = 'production';,Enable replication for database clusters in the 'production' environment.,"###Human:
Enable replication for database clusters in the 'production' environment.
###Assistant:
UPDATE database_clusters SET replication_enabled = 1 WHERE environment = 'production';"
DELETE FROM container_instances WHERE memory_utilization > 80;,Delete container instances with memory utilization over 80%.,"###Human:
Delete container instances with memory utilization over 80%.
###Assistant:
DELETE FROM container_instances WHERE memory_utilization > 80;"
"SELECT service_name, MAX(response_time) AS max_response_time FROM service_metrics GROUP BY service_name;",Find the maximum response time for each service from metrics data.,"###Human:
Find the maximum response time for each service from metrics data.
###Assistant:
SELECT service_name, MAX(response_time) AS max_response_time FROM service_metrics GROUP BY service_name;"
UPDATE caching_servers SET caching_enabled = 0 WHERE cache_hit_rate < 0.5;,Disable caching for servers with a cache hit rate lower than 50%.,"###Human:
Disable caching for servers with a cache hit rate lower than 50%.
###Assistant:
UPDATE caching_servers SET caching_enabled = 0 WHERE cache_hit_rate < 0.5;"
DELETE FROM build_records WHERE build_date < '2023-03-01';,"Remove build records that are dated before March 1, 2023.","###Human:
Remove build records that are dated before March 1, 2023.
###Assistant:
DELETE FROM build_records WHERE build_date < '2023-03-01';"
"SELECT server_name, COUNT(*) AS warning_count FROM server_logs WHERE log_level = 'warning' GROUP BY server_name;",Count the number of warning logs on each server.,"###Human:
Count the number of warning logs on each server.
###Assistant:
SELECT server_name, COUNT(*) AS warning_count FROM server_logs WHERE log_level = 'warning' GROUP BY server_name;"
UPDATE scaling_groups SET min_instances = 5 WHERE current_instances > 5;,Increase the minimum instances to 5 for scaling groups with more than 5 current instances.,"###Human:
Increase the minimum instances to 5 for scaling groups with more than 5 current instances.
###Assistant:
UPDATE scaling_groups SET min_instances = 5 WHERE current_instances > 5;"
|