Identify mutual investors across Tata Capital and SBI Mutual Funds. Dataset: CREATE…
- User
Identify mutual investors across Tata Capital and SBI Mutual Funds.
Dataset: CREATE TABLE tata_investors ( investor_id INT, investor_name VARCHAR(100), invested_amount DECIMAL(12,2) ); CREATE TABLE sbi_investors ( investor_id INT, investor_name VARCHAR(100), invested_amount DECIMAL(12,2) ); INSERT INTO tata_investors VALUES (1, 'Amit Patil', 1000000.00), (2, 'Neha Reddy', 1500000.00), (3, 'Vikas Yadav', 750000.00); INSERT INTO sbi_investors VALUES (2, 'Neha Reddy', 2000000.00), (3, 'Vikas Yadav', 500000.00), (4, 'Manoj Tiwari', 1200000.00);
- Assistant
To identify mutual investors across Tata Capital and SBI Mutual Funds from the given dataset, we need to find entries that appear in both the
tata_investorsandsbi_investorstables based on theinvestor_idorinvestor_name. Here is a SQL query to accomplish this:sqlSELECT t.investor_id, t.investor_name FROM tata_investors t JOIN sbi_investors s ON t.investor_id = s.investor_id;Running this query would result in the following output:
code| investor_id | investor_name | |-------------|---------------| | 2 | Neha Reddy | | 3 | Vikas Yadav |Thus, the mutual investors across Tata Capital and SBI Mutual Funds are Neha Reddy and Vikas Yadav.
- User
Assign performance ratings based on sales amount from the sales table.
📚 Dataset: CREATE TABLE sales (sale_id INT PRIMARY KEY, amount DECIMAL(10,2)); INSERT INTO sales VALUES (1, 15000), (2, 7000), (3, 3000);
- Assistant
To assign performance ratings based on the sales amount from the
salestable, we need to define criteria or thresholds for these ratings. For example, you might decide on the following rating criteria:- "High" rating for sales amounts greater than or equal to $10,000.
- "Medium" rating for sales amounts between 9,999.
- "Low" rating for sales amounts less than $5,000.
Here is a SQL query that implements these criteria and assigns a performance rating to each sale in the table:
- User
List all customers who have made purchases in all product categories and the total amount they spent.
drop table if exists customers; CREATE TABLE customers ( customer_id INT, customer_name VARCHAR(100) ); drop table if exists products; CREATE TABLE products ( product_id INT, product_name VARCHAR(100), category_id INT, price DECIMAL(10, 2) ); drop table if exists purchases; CREATE TABLE purchases ( purchase_id INT, customer_id INT, product_id INT ); INSERT INTO customers VALUES (1, 'Alice'), (2, 'Bob'), (3, 'Charlie'); INSERT INTO products VALUES (1, 'Laptop', 1, 800), (2, 'Smartphone', 1, 600), (3, 'Book', 2, 20), (4, 'Headphones', 1, 150); INSERT INTO purchases VALUES (1, 1, 1), (2, 1, 2), (3, 1, 3), (4, 2, 2), (5, 2, 3), (6, 3, 1), (7, 3, 2), (8, 3, 4);
- Assistant
To identify customers who have made purchases in all product categories and calculate the total amount they spent, we need to perform a series of operations including joining tables, checking for purchases in all categories, and summing up the amounts.
Here's a SQL query to achieve this:
sql
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.