devcommands / sql4.csv
bdbautomation's picture
Upload sql4.csv
fc8480f
Raw History Blame
18.8 kB
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;"