[User] Retrieve status, traded_at, currency for every payment.

[Assistant] SELECT status, traded_at, currency FROM finance.payments;

[User] Show the results sorted by customer_id descending.

[Assistant] SELECT status, traded_at, currency FROM finance.payments ORDER BY customer_id DESC;

[User] Show the results sorted by buyer_id ascending.

[Assistant] SELECT status, traded_at, currency FROM finance.payments ORDER BY buyer_id ASC;


System:
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE finance.customers (
  id integer PRIMARY KEY -- unique identifier,
  created_at timestamp,
  updated_at timestamp,
  salt character varying(128) NOT NULL,
  age varchar,
  birth_date timestamp without time zone NOT NULL,
  gender character varying(256),
  full_name text,
  payment_id text NOT NULL -- reference to payments.id,
  FOREIGN KEY (payment_id) REFERENCES payments(id)
)

CREATE TABLE finance.payments (
  id text PRIMARY KEY -- unique identifier,
  completed_at date,
  traded_at timestamp without time zone,
  card_type text,
  payment_method character varying(128),
  status char,
  buyer_id character varying(64) -- identifier for buyer,
  amount integer NOT NULL,
  currency character varying(128),
  customer_id integer -- reference to customers.id,
  FOREIGN KEY (customer_id) REFERENCES customers(id)
)

[User] Get age, full_name, birth_date from all customers.

[Assistant] SELECT age, full_name, birth_date FROM finance.customers;

[User] Get payment_id, age, currency, customer_id by joining customers with payments.

[Assistant] SELECT age, full_name, birth_date, payments.currency, payments.customer_id FROM finance.customers JOIN finance.payments ON customers.payment_id = payments.id;

[User] Group customers by birth_date and show the max of created_at.

[Assistant] SELECT birth_date, MAX(created_at) AS max_created_at FROM finance.customers GROUP BY birth_date;


[User] Get all customers.

[Assistant] SELECT * FROM finance.customers;

[User] Arrange the results with birth_date in ascending order.

[Assistant] SELECT * FROM finance.customers ORDER BY birth_date ASC;

[User] Group customers by birth_date and show the sum of age.

[Assistant] SELECT birth_date, SUM(age) AS sum_age FROM finance.customers GROUP BY birth_date;


[User] List birth_date, full_name, updated_at from customers.

[Assistant] SELECT birth_date, full_name, updated_at FROM finance.customers;

[User] Sort the results by age descending.

[Assistant] SELECT birth_date, full_name, updated_at FROM finance.customers ORDER BY age DESC;

[User] Show me the count of customers grouped by full_name.

[Assistant] SELECT full_name, COUNT(*) AS count FROM finance.customers GROUP BY full_name ORDER BY count DESC;


System:
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE socialmedia.messages (
  comment_id character varying(64) NOT NULL -- unique identifier,
  edited_at timestamp without time zone,
  image_url character varying(256),
  content varchar NOT NULL,
  event_id text NOT NULL -- reference to events.sku,
  FOREIGN KEY (event_id) REFERENCES events(sku)
)

CREATE TABLE socialmedia.events (
  sku text PRIMARY KEY -- unique identifier,
  created_at timestamp without time zone,
  published_at date,
  price numeric,
  thumbnail_url character varying(256) NOT NULL,
  reserved character varying(256) NOT NULL,
  video_url varchar,
  name character varying(128),
  image_url text
)

CREATE TABLE socialmedia.comments (
  message_id varchar PRIMARY KEY -- unique identifier,
  edited_at timestamp,
  likes varchar,
  image_url varchar,
  thumbnail character varying(256) NOT NULL,
  body char,
  user_id text -- identifier for user,
  subject text NOT NULL
)

[User] List all messages.

[Assistant] SELECT * FROM socialmedia.messages;

[User] List messages with dates from last week.

[Assistant] SELECT * FROM socialmedia.messages WHERE edited_at >= CURRENT_DATE - INTERVAL '7 days';

[User] Group messages by image_url and show the min of comment_id.

[Assistant] SELECT image_url, MIN(comment_id) AS min_comment_id FROM socialmedia.messages GROUP BY image_url;


[User] Get event_id, edited_at, content from all messages.

[Assistant] SELECT event_id, edited_at, content FROM socialmedia.messages;

[User] Get messages that match image_url LIKE 'A%'.

[Assistant] SELECT event_id, edited_at, content FROM socialmedia.messages WHERE image_url LIKE 'A%';

[User] Count the number of messages in each comment_id category.

[Assistant] SELECT comment_id, COUNT(*) AS count FROM socialmedia.messages GROUP BY comment_id ORDER BY count DESC;


[User] List all messages.

[Assistant] SELECT * FROM socialmedia.messages;

[User] Get all messages created yesterday.

[Assistant] SELECT * FROM socialmedia.messages WHERE edited_at = CURRENT_DATE - INTERVAL '1 day';

[User] Limit the results to 20 rows.

[Assistant] SELECT * FROM socialmedia.messages WHERE edited_at = CURRENT_DATE - INTERVAL '1 day' LIMIT 20;


[User] Get all messages.

[Assistant] SELECT * FROM socialmedia.messages;

[User] Retrieve content, comment_id, published_at, created_at showing the relationship between messages and events.

[Assistant] SELECT *, events.published_at, events.created_at FROM socialmedia.messages JOIN socialmedia.events ON messages.event_id = events.sku;

[User] Calculate min of edited_at for each comment_id in messages.

[Assistant] SELECT comment_id, MIN(edited_at) AS min_edited_at FROM socialmedia.messages GROUP BY comment_id;


[User] Display all messages.

[Assistant] SELECT * FROM socialmedia.messages;

[User] Show the results sorted by content ascending.

[Assistant] SELECT * FROM socialmedia.messages ORDER BY content ASC;

[User] What is the max image_url for each content in messages?

[Assistant] SELECT content, MAX(image_url) AS max_image_url FROM socialmedia.messages GROUP BY content;


[User] Show me image_url, content, comment_id for all messages.

[Assistant] SELECT image_url, content, comment_id FROM socialmedia.messages;

[User] List content, image_url, thumbnail_url, name for each message along with their event information.

[Assistant] SELECT image_url, content, comment_id, events.thumbnail_url, events.name FROM socialmedia.messages JOIN socialmedia.events ON messages.event_id = events.sku;

[User] Restrict the output to 5 items.

[Assistant] SELECT image_url, content, comment_id, events.thumbnail_url, events.name FROM socialmedia.messages JOIN socialmedia.events ON messages.event_id = events.sku LIMIT 5;


[User] Display all messages.

[Assistant] SELECT * FROM socialmedia.messages;

[User] Show me messages that were from 2023.

[Assistant] SELECT * FROM socialmedia.messages WHERE edited_at BETWEEN '2023-01-01' AND '2023-12-31';

[User] Order the output by content descending.

[Assistant] SELECT * FROM socialmedia.messages WHERE edited_at BETWEEN '2023-01-01' AND '2023-12-31' ORDER BY content DESC;


[User] List edited_at, content, image_url from messages.

[Assistant] SELECT edited_at, content, image_url FROM socialmedia.messages;

[User] List event_id, edited_at, video_url, reserved for each message along with their event information.

[Assistant] SELECT edited_at, content, image_url, events.video_url, events.reserved FROM socialmedia.messages JOIN socialmedia.events ON messages.event_id = events.sku;

[User] Arrange the results with content in descending order.

[Assistant] SELECT edited_at, content, image_url, events.video_url, events.reserved FROM socialmedia.messages JOIN socialmedia.events ON messages.event_id = events.sku ORDER BY content DESC;


[User] Retrieve all messages.

[Assistant] SELECT * FROM socialmedia.messages;

[User] Retrieve messages where the date is modified within the last hour.

[Assistant] SELECT * FROM socialmedia.messages WHERE edited_at >= CURRENT_TIMESTAMP - INTERVAL '1 hour';

[User] Limit the results to 15 rows.

[Assistant] SELECT * FROM socialmedia.messages WHERE edited_at >= CURRENT_TIMESTAMP - INTERVAL '1 hour' LIMIT 15;


[User] Get event_id, comment_id, edited_at from all messages.

[Assistant] SELECT event_id, comment_id, edited_at FROM socialmedia.messages;

[User] Retrieve messages where the date is created in the last 30 days.

[Assistant] SELECT event_id, comment_id, edited_at FROM socialmedia.messages WHERE edited_at >= CURRENT_DATE - INTERVAL '30 days';

[User] Show me the count of messages grouped by comment_id.

[Assistant] SELECT comment_id, COUNT(*) AS count FROM socialmedia.messages GROUP BY comment_id ORDER BY count DESC;


System:
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE healthcare.appointments (
  content_id character varying(64) NOT NULL -- unique identifier,
  updated_at date,
  reply_to_id character varying(256) -- identifier for reply_to,
  body char NOT NULL,
  thumbnail character varying(256) NOT NULL,
  media_url character varying(256),
  keywords character varying(64),
  image_url varchar,
  visibility text NOT NULL,
  doctor_id text NOT NULL -- reference to doctors.sku,
  billin_id integer -- reference to billing.id,
  FOREIGN KEY (doctor_id) REFERENCES doctors(sku),
  FOREIGN KEY (billin_id) REFERENCES billing(id)
)

CREATE TABLE healthcare.billing (
  id integer PRIMARY KEY -- unique identifier,
  updated_at timestamp,
  payment_method character varying(128),
  currency character varying(64),
  card_type character varying(256) NOT NULL,
  payment_status char,
  delivery_status character varying(64),
  quantity character varying(64),
  exchange_rate character varying(256),
  doctor_id text NOT NULL -- reference to doctors.sku,
  FOREIGN KEY (doctor_id) REFERENCES doctors(sku)
)

CREATE TABLE healthcare.doctors (
  sku varchar PRIMARY KEY -- unique identifier,
  expires_at timestamp without time zone,
  quantity character varying(64),
  thumbnail_url text,
  description character varying(128) NOT NULL,
  available text,
  name character varying(256) NOT NULL,
  discount numeric(38,14)
)

[User] List all billing.

[Assistant] SELECT * FROM healthcare.billing;

[User] Retrieve billing where the date is from 2023.

[Assistant] SELECT * FROM healthcare.billing WHERE updated_at BETWEEN '2023-01-01' AND '2023-12-31';

[User] Show me min of doctor_id grouped by card_type for billing.

[Assistant] SELECT card_type, MIN(doctor_id) AS min_doctor_id FROM healthcare.billing GROUP BY card_type;


[User] Display all billing.

[Assistant] SELECT * FROM healthcare.billing;

[User] List billing that have delivery_status LIKE 'A%'.

[Assistant] SELECT * FROM healthcare.billing WHERE delivery_status LIKE 'A%';

[User] Get count of doctor_id by delivery_status from billing.

[Assistant] SELECT delivery_status, COUNT(doctor_id) AS count_doctor_id FROM healthcare.billing GROUP BY delivery_status;


[User] List payment_status, currency, card_type from billing.

[Assistant] SELECT payment_status, currency, card_type FROM healthcare.billing;

[User] Find billing created yesterday.

[Assistant] SELECT payment_status, currency, card_type FROM healthcare.billing WHERE updated_at = CURRENT_DATE - INTERVAL '1 day';

[User] Only show the top 25 results.

[Assistant] SELECT payment_status, currency, card_type FROM healthcare.billing WHERE updated_at = CURRENT_DATE - INTERVAL '1 day' LIMIT 25;


[User] Get all appointments.

[Assistant] SELECT * FROM healthcare.appointments;

[User] Show the results sorted by reply_to_id ascending.

[Assistant] SELECT * FROM healthcare.appointments ORDER BY reply_to_id ASC;

[User] How many appointments are there per image_url?

[Assistant] SELECT image_url, COUNT(*) AS count FROM healthcare.appointments GROUP BY image_url ORDER BY count DESC;


[User] Show me all appointments.

[Assistant] SELECT * FROM healthcare.appointments;

[User] Sort the results by visibility ascending.

[Assistant] SELECT * FROM healthcare.appointments ORDER BY visibility ASC;

[User] What is the sum visibility for each keywords in appointments?

[Assistant] SELECT keywords, SUM(visibility) AS sum_visibility FROM healthcare.appointments GROUP BY keywords;


System:
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE tradingplatform.trades (
  order_id varchar PRIMARY KEY -- unique identifier,
  cancelled_at timestamp without time zone,
  customer_id char -- identifier for customer,
  exchange_rate char,
  product_id varchar NOT NULL,
  delivery_status text NOT NULL,
  asset_id text -- reference to assets.product_id,
  metadat_id text NOT NULL -- reference to metadata.employee_id,
  FOREIGN KEY (asset_id) REFERENCES assets(product_id),
  FOREIGN KEY (metadat_id) REFERENCES metadata(employee_id)
)

CREATE TABLE tradingplatform.assets (
  product_id varchar PRIMARY KEY -- unique identifier,
  expires_at timestamp,
  created_at timestamp,
  thumbnail_url character varying(256),
  rating character varying(64)
)

CREATE TABLE tradingplatform.metadata (
  employee_id text PRIMARY KEY -- unique identifier,
  updated_at date,
  created_at timestamp,
  birth_date timestamp,
  city varchar,
  bio character varying(256),
  avatar char,
  language char NOT NULL,
  first_name varchar,
  trade_id text -- reference to trades.order_id,
  FOREIGN KEY (trade_id) REFERENCES trades(order_id)
)

CREATE TABLE tradingplatform.logs (
  location_id character varying(64) NOT NULL -- unique identifier,
  last_inspected timestamp without time zone,
  created_at date,
  parking_available character varying(128) NOT NULL,
  location_lon varchar NOT NULL,
  zip_code varchar,
  type character varying(128),
  metadat_id text -- reference to metadata.employee_id,
  FOREIGN KEY (metadat_id) REFERENCES metadata(employee_id)
)

[User] List all metadata.

[Assistant] SELECT * FROM tradingplatform.metadata;

[User] Sort the results by birth_date descending.

[Assistant] SELECT * FROM tradingplatform.metadata ORDER BY birth_date DESC;

[User] Show only 5 records.

[Assistant] SELECT * FROM tradingplatform.metadata ORDER BY birth_date DESC LIMIT 5;


[User] Display all metadata.

[Assistant] SELECT * FROM tradingplatform.metadata;

[User] Show the results sorted by created_at ascending.

[Assistant] SELECT * FROM tradingplatform.metadata ORDER BY created_at ASC;

[User] Limit the results to 10 rows.

[Assistant] SELECT * FROM tradingplatform.metadata ORDER BY created_at ASC LIMIT 10;


System:
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE education.students (
  employee_id integer PRIMARY KEY -- unique identifier,
  created_at timestamp without time zone,
  updated_at timestamp,
  state character varying(128),
  birth_date timestamp,
  timezone text,
  full_name character varying(256) NOT NULL,
  teacher_id text -- reference to teachers.employee_id,
  FOREIGN KEY (teacher_id) REFERENCES teachers(employee_id)
)

CREATE TABLE education.grades (
  transaction_id text PRIMARY KEY -- unique identifier,
  completed_at date,
  exchange_rate varchar NOT NULL,
  delivery_status text,
  payment_status character varying(128),
  amount bigint,
  fee text,
  student_id integer -- reference to students.employee_id,
  FOREIGN KEY (student_id) REFERENCES students(employee_id)
)

CREATE TABLE education.teachers (
  employee_id varchar PRIMARY KEY -- unique identifier,
  created_at timestamp without time zone,
  last_active date,
  website character varying(256) NOT NULL,
  full_name text NOT NULL,
  last_login timestamp,
  avatar character varying(128) NOT NULL,
  salt char NOT NULL,
  student_id integer NOT NULL -- reference to students.employee_id,
  FOREIGN KEY (student_id) REFERENCES students(employee_id)
)

[User] Get all students.

[Assistant] SELECT * FROM education.students;

[User] Show me state, teacher_id, created_at, full_name from students and their related teachers.

[Assistant] SELECT *, teachers.created_at, teachers.full_name FROM education.students JOIN education.teachers ON students.teacher_id = teachers.employee_id;

[User] Arrange the results with full_name in ascending order.

[Assistant] SELECT *, teachers.created_at, teachers.full_name FROM education.students JOIN education.teachers ON students.teacher_id = teachers.employee_id ORDER BY full_name ASC;


[User] Display all students.

[Assistant] SELECT * FROM education.students;

[User] Get teacher_id, created_at, created_at, website by joining students with teachers.

[Assistant] SELECT *, teachers.created_at, teachers.website FROM education.students JOIN education.teachers ON students.teacher_id = teachers.employee_id;

[User] Calculate min of teacher_id for each created_at in students.

[Assistant] SELECT created_at, MIN(teacher_id) AS min_teacher_id FROM education.students GROUP BY created_at;


[User] List all teachers.

[Assistant] SELECT * FROM education.teachers;

[User] Show me teachers that were from last week.

[Assistant] SELECT * FROM education.teachers WHERE last_login >= CURRENT_DATE - INTERVAL '7 days';

[User] Restrict the output to 25 items.

[Assistant] SELECT * FROM education.teachers WHERE last_login >= CURRENT_DATE - INTERVAL '7 days' LIMIT 25;


[User] List all teachers.

[Assistant] SELECT * FROM education.teachers;

[User] Sort the results by website ascending.

[Assistant] SELECT * FROM education.teachers ORDER BY website ASC;

[User] Calculate sum of website for each last_active in teachers.

[Assistant] SELECT last_active, SUM(website) AS sum_website FROM education.teachers GROUP BY last_active;


[User] List completed_at, student_id, amount from grades.

[Assistant] SELECT completed_at, student_id, amount FROM education.grades;

[User] Get all grades between January and March.

[Assistant] SELECT completed_at, student_id, amount FROM education.grades WHERE completed_at BETWEEN '2023-01-01' AND '2023-03-31';

[User] Show me max of delivery_status grouped by completed_at for grades.

[Assistant] SELECT completed_at, MAX(delivery_status) AS max_delivery_status FROM education.grades GROUP BY completed_at;


[User] Get all students.

[Assistant] SELECT * FROM education.students;

[User] Show me students with timezone LIKE 'A%'.

[Assistant] SELECT * FROM education.students WHERE timezone LIKE 'A%';

[User] Show only 25 records.

[Assistant] SELECT * FROM education.students WHERE timezone LIKE 'A%' LIMIT 25;


[User] List all teachers.

[Assistant] SELECT * FROM education.teachers;

[User] Show me created_at, website, state, teacher_id from teachers and their related students.

[Assistant] SELECT *, students.state, students.teacher_id FROM education.teachers JOIN education.students ON teachers.student_id = students.employee_id;

[User] Count the number of teachers in each salt category.

[Assistant] SELECT salt, COUNT(*) AS count FROM education.teachers GROUP BY salt ORDER BY count DESC;


[User] Show me exchange_rate, student_id, amount for all grades.

[Assistant] SELECT exchange_rate, student_id, amount FROM education.grades;

[User] Sort the results by delivery_status descending.

[Assistant] SELECT exchange_rate, student_id, amount FROM education.grades ORDER BY delivery_status DESC;

[User] Show the results sorted by delivery_status descending.

[Assistant] SELECT exchange_rate, student_id, amount FROM education.grades ORDER BY delivery_status DESC;


[User] Show me all grades.

[Assistant] SELECT * FROM education.grades;

[User] Can you order these by completed_at ascending?

[Assistant] SELECT * FROM education.grades ORDER BY completed_at ASC;

[User] Tally up grades by amount.

[Assistant] SELECT amount, COUNT(*) AS count FROM education.grades GROUP BY amount ORDER BY count DESC;


[User] What are the last_active, salt, created_at of each teacher?

[Assistant] SELECT last_active, salt, created_at FROM education.teachers;

[User] Retrieve student_id, full_name, created_at, full_name showing the relationship between teachers and students.

[Assistant] SELECT last_active, salt, created_at, students.created_at, students.full_name FROM education.teachers JOIN education.students ON teachers.student_id = students.employee_id;

[User] Get count of last_active by avatar from teachers.

[Assistant] SELECT avatar, COUNT(last_active) AS count_last_active FROM education.teachers GROUP BY avatar;


System:
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE finance.transactions (
  payment_id text PRIMARY KEY -- unique identifier,
  updated_at timestamp without time zone,
  exchange_rate character varying(256) NOT NULL,
  approval_status char,
  customer_id integer -- reference to customers.id,
  account_id integer NOT NULL -- reference to accounts.id,
  FOREIGN KEY (customer_id) REFERENCES customers(id),
  FOREIGN KEY (account_id) REFERENCES accounts(id)
)

CREATE TABLE finance.accounts (
  id integer PRIMARY KEY -- unique identifier,
  updated_at date,
  due_date timestamp without time zone,
  customer_id varchar,
  status character varying(128),
  category character varying(64),
  reference_number char NOT NULL,
  reconciliation_status character varying(64)
)

CREATE TABLE finance.customers (
  id integer PRIMARY KEY -- unique identifier,
  joined_at timestamp without time zone,
  first_name character varying(64),
  language char,
  transaction_id text -- reference to transactions.payment_id,
  FOREIGN KEY (transaction_id) REFERENCES transactions(payment_id)
)

[User] List all transactions.

[Assistant] SELECT * FROM finance.transactions;

[User] Find transactions created in the last 30 days.

[Assistant] SELECT * FROM finance.transactions WHERE updated_at >= CURRENT_DATE - INTERVAL '30 days';

[User] Show the results sorted by updated_at ascending.

[Assistant] SELECT * FROM finance.transactions WHERE updated_at >= CURRENT_DATE - INTERVAL '30 days' ORDER BY updated_at ASC;


[User] Display all transactions.

[Assistant] SELECT * FROM finance.transactions;

[User] List updated_at, account_id, transaction_id, joined_at for each transaction along with their customer information.

[Assistant] SELECT *, customers.transaction_id, customers.joined_at FROM finance.transactions JOIN finance.customers ON transactions.customer_id = customers.id;

[User] Return just 100 rows.

[Assistant] SELECT *, customers.transaction_id, customers.joined_at FROM finance.transactions JOIN finance.customers ON transactions.customer_id = customers.id LIMIT 100;


[User] Show me all customers.

[Assistant] SELECT * FROM finance.customers;

[User] List customers that have transaction_id LIKE 'A%'.

[Assistant] SELECT * FROM finance.customers WHERE transaction_id LIKE 'A%';

[User] Order the output by joined_at descending.

[Assistant] SELECT * FROM finance.customers WHERE transaction_id LIKE 'A%' ORDER BY joined_at DESC;


[User] Retrieve all transactions.

[Assistant] SELECT * FROM finance.transactions;

[User] Order the output by customer_id ascending.

[Assistant] SELECT * FROM finance.transactions ORDER BY customer_id ASC;

[User] Restrict the output to 25 items.

[Assistant] SELECT * FROM finance.transactions ORDER BY customer_id ASC LIMIT 25;


[User] Get joined_at, language, transaction_id from all customers.

[Assistant] SELECT joined_at, language, transaction_id FROM finance.customers;

[User] Retrieve customers where joined_at > '2023-01-01'.

[Assistant] SELECT joined_at, language, transaction_id FROM finance.customers WHERE joined_at > '2023-01-01';

[User] Only show the top 50 results.

[Assistant] SELECT joined_at, language, transaction_id FROM finance.customers WHERE joined_at > '2023-01-01' LIMIT 50;


[User] Display all customers.

[Assistant] SELECT * FROM finance.customers;

[User] Show me customers with transaction_id LIKE 'A%'.

[Assistant] SELECT * FROM finance.customers WHERE transaction_id LIKE 'A%';

[User] Return just 20 rows.

[Assistant] SELECT * FROM finance.customers WHERE transaction_id LIKE 'A%' LIMIT 20;


[User] Retrieve updated_at, approval_status, customer_id for every transaction.

[Assistant] SELECT updated_at, approval_status, customer_id FROM finance.transactions;

[User] Show the results sorted by account_id descending.

[Assistant] SELECT updated_at, approval_status, customer_id FROM finance.transactions ORDER BY account_id DESC;

[User] Show me the count of transactions grouped by approval_status.

[Assistant] SELECT approval_status, COUNT(*) AS count FROM finance.transactions GROUP BY approval_status ORDER BY count DESC;


[User] Get all customers.

[Assistant] SELECT * FROM finance.customers;

[User] Show me customers that were created after December 1st, 2023.

[Assistant] SELECT * FROM finance.customers WHERE joined_at > '2023-12-01';

[User] Arrange the results with joined_at in ascending order.

[Assistant] SELECT * FROM finance.customers WHERE joined_at > '2023-12-01' ORDER BY joined_at ASC;


[User] Get language, joined_at, first_name from all customers.

[Assistant] SELECT language, joined_at, first_name FROM finance.customers;

[User] Find customers where language LIKE 'A%'.

[Assistant] SELECT language, joined_at, first_name FROM finance.customers WHERE language LIKE 'A%';

[User] Sort the results by joined_at descending.

[Assistant] SELECT language, joined_at, first_name FROM finance.customers WHERE language LIKE 'A%' ORDER BY joined_at DESC;


[User] Show me updated_at, approval_status, exchange_rate for all transactions.

[Assistant] SELECT updated_at, approval_status, exchange_rate FROM finance.transactions;

[User] What updated_at, exchange_rate, language, transaction_id do we have for transactions and their associated customers?

[Assistant] SELECT updated_at, approval_status, exchange_rate, customers.language, customers.transaction_id FROM finance.transactions JOIN finance.customers ON transactions.customer_id = customers.id;

[User] Show only 5 records.

[Assistant] SELECT updated_at, approval_status, exchange_rate, customers.language, customers.transaction_id FROM finance.transactions JOIN finance.customers ON transactions.customer_id = customers.id LIMIT 5;


System:
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE e-commerce.orders (
  transaction_id integer PRIMARY KEY -- unique identifier,
  completed_at timestamp,
  cancelled_at date,
  quantity char,
  payment_status character varying(256),
  discount numeric,
  card_type text NOT NULL,
  approval_status character varying(64),
  product_id character varying(128)
)

CREATE TABLE e-commerce.users (
  employee_id character varying(64) NOT NULL -- unique identifier,
  joined_at timestamp without time zone,
  gender character varying(128),
  language character varying(256),
  profile_picture_url character varying(128) NOT NULL
)

[User] Get all users.

[Assistant] SELECT * FROM e-commerce.users;

[User] Get users that match joined_at > '2023-01-01'.

[Assistant] SELECT * FROM e-commerce.users WHERE joined_at > '2023-01-01';

[User] Order the output by language descending.

[Assistant] SELECT * FROM e-commerce.users WHERE joined_at > '2023-01-01' ORDER BY language DESC;


[User] List joined_at, profile_picture_url, employee_id from users.

[Assistant] SELECT joined_at, profile_picture_url, employee_id FROM e-commerce.users;

[User] Arrange the results with employee_id in ascending order.

[Assistant] SELECT joined_at, profile_picture_url, employee_id FROM e-commerce.users ORDER BY employee_id ASC;

[User] Calculate count of joined_at for each language in users.

[Assistant] SELECT language, COUNT(joined_at) AS count_joined_at FROM e-commerce.users GROUP BY language;


[User] Show me product_id, card_type, completed_at for all orders.

[Assistant] SELECT product_id, card_type, completed_at FROM e-commerce.orders;

[User] Show me orders that were modified within the last hour.

[Assistant] SELECT product_id, card_type, completed_at FROM e-commerce.orders WHERE cancelled_at >= CURRENT_TIMESTAMP - INTERVAL '1 hour';

[User] Can you order these by card_type descending?

[Assistant] SELECT product_id, card_type, completed_at FROM e-commerce.orders WHERE cancelled_at >= CURRENT_TIMESTAMP - INTERVAL '1 hour' ORDER BY card_type DESC;


[User] Display all users.

[Assistant] SELECT * FROM e-commerce.users;

[User] Can you order these by gender ascending?

[Assistant] SELECT * FROM e-commerce.users ORDER BY gender ASC;

[User] Return just 5 rows.

[Assistant] SELECT * FROM e-commerce.users ORDER BY gender ASC LIMIT 5;


[User] List all orders.

[Assistant] SELECT * FROM e-commerce.orders;

[User] Find orders created in the last 30 days.

[Assistant] SELECT * FROM e-commerce.orders WHERE cancelled_at >= CURRENT_DATE - INTERVAL '30 days';

[User] Show the results sorted by payment_status descending.

[Assistant] SELECT * FROM e-commerce.orders WHERE cancelled_at >= CURRENT_DATE - INTERVAL '30 days' ORDER BY payment_status DESC;


[User] Display all orders.

[Assistant] SELECT * FROM e-commerce.orders;

[User] Show me orders with card_type LIKE 'A%'.

[Assistant] SELECT * FROM e-commerce.orders WHERE card_type LIKE 'A%';

[User] Restrict the output to 10 items.

[Assistant] SELECT * FROM e-commerce.orders WHERE card_type LIKE 'A%' LIMIT 10;


[User] What are the employee_id, profile_picture_url, language of each user?

[Assistant] SELECT employee_id, profile_picture_url, language FROM e-commerce.users;

[User] Show me users that were created after December 1st, 2023.

[Assistant] SELECT employee_id, profile_picture_url, language FROM e-commerce.users WHERE joined_at > '2023-12-01';

[User] Show me max of profile_picture_url grouped by gender for users.

[Assistant] SELECT gender, MAX(profile_picture_url) AS max_profile_picture_url FROM e-commerce.users GROUP BY gender;


[User] Show me all orders.

[Assistant] SELECT * FROM e-commerce.orders;

[User] Arrange the results with card_type in ascending order.

[Assistant] SELECT * FROM e-commerce.orders ORDER BY card_type ASC;

[User] Show only 25 records.

[Assistant] SELECT * FROM e-commerce.orders ORDER BY card_type ASC LIMIT 25;


[User] Display all orders.

[Assistant] SELECT * FROM e-commerce.orders;

[User] Sort the results by completed_at ascending.

[Assistant] SELECT * FROM e-commerce.orders ORDER BY completed_at ASC;

[User] Restrict the output to 100 items.

[Assistant] SELECT * FROM e-commerce.orders ORDER BY completed_at ASC LIMIT 100;


[User] Show me all users.

[Assistant] SELECT * FROM e-commerce.users;

[User] Retrieve users where employee_id LIKE 'A%'.

[Assistant] SELECT * FROM e-commerce.users WHERE employee_id LIKE 'A%';

[User] Restrict the output to 50 items.

[Assistant] SELECT * FROM e-commerce.users WHERE employee_id LIKE 'A%' LIMIT 50;


System:
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE healthcare.medical_records (
  invoice_id character varying(64) NOT NULL -- unique identifier,
  completed_at timestamp without time zone,
  customer_id character varying(64) NOT NULL,
  card_type text NOT NULL,
  user_id character varying(256) NOT NULL,
  buyer_id text -- identifier for buyer
)

CREATE TABLE healthcare.prescriptions (
  venue_id integer PRIMARY KEY -- unique identifier,
  last_inspected date,
  updated_at timestamp without time zone,
  description char NOT NULL,
  coordinates character varying(128),
  parking_available text
)

CREATE TABLE healthcare.doctors (
  location_id integer PRIMARY KEY -- unique identifier,
  created_at timestamp without time zone,
  category character varying(64) NOT NULL,
  coordinates character varying(128),
  type text NOT NULL,
  longitude character varying(128),
  address_line2 varchar NOT NULL,
  city character varying(64)
)

CREATE TABLE healthcare.patients (
  customer_id character varying(64) NOT NULL -- unique identifier,
  created_at timestamp without time zone,
  joined_at timestamp without time zone,
  full_name character varying(256),
  avatar character varying(64),
  api_key character varying(128),
  doctor_id integer -- reference to doctors.location_id,
  FOREIGN KEY (doctor_id) REFERENCES doctors(location_id)
)

[User] Get all patients.

[Assistant] SELECT * FROM healthcare.patients;

[User] List patients that have joined_at > '2023-01-01'.

[Assistant] SELECT * FROM healthcare.patients WHERE joined_at > '2023-01-01';

[User] Restrict the output to 10 items.

[Assistant] SELECT * FROM healthcare.patients WHERE joined_at > '2023-01-01' LIMIT 10;


[User] List all patients.

[Assistant] SELECT * FROM healthcare.patients;

[User] Can you order these by created_at ascending?

[Assistant] SELECT * FROM healthcare.patients ORDER BY created_at ASC;

[User] Get the distribution of patients across different joined_at values.

[Assistant] SELECT joined_at, COUNT(*) AS count FROM healthcare.patients GROUP BY joined_at ORDER BY count DESC;


[User] Show me doctor_id, customer_id, full_name for all patients.

[Assistant] SELECT doctor_id, customer_id, full_name FROM healthcare.patients;

[User] Sort the results by full_name descending.

[Assistant] SELECT doctor_id, customer_id, full_name FROM healthcare.patients ORDER BY full_name DESC;

[User] Sort the results by api_key descending.

[Assistant] SELECT doctor_id, customer_id, full_name FROM healthcare.patients ORDER BY api_key DESC;


[User] Get all patients.

[Assistant] SELECT * FROM healthcare.patients;

[User] Find patients modified within the last hour.

[Assistant] SELECT * FROM healthcare.patients WHERE joined_at >= CURRENT_TIMESTAMP - INTERVAL '1 hour';

[User] Order the output by joined_at ascending.

[Assistant] SELECT * FROM healthcare.patients WHERE joined_at >= CURRENT_TIMESTAMP - INTERVAL '1 hour' ORDER BY joined_at ASC;


[User] Get api_key, avatar, doctor_id from all patients.

[Assistant] SELECT api_key, avatar, doctor_id FROM healthcare.patients;

[User] Retrieve patients where the date is created in the last 30 days.

[Assistant] SELECT api_key, avatar, doctor_id FROM healthcare.patients WHERE joined_at >= CURRENT_DATE - INTERVAL '30 days';

[User] Show the results sorted by doctor_id descending.

[Assistant] SELECT api_key, avatar, doctor_id FROM healthcare.patients WHERE joined_at >= CURRENT_DATE - INTERVAL '30 days' ORDER BY doctor_id DESC;


[User] List api_key, customer_id, doctor_id from patients.

[Assistant] SELECT api_key, customer_id, doctor_id FROM healthcare.patients;

[User] List patients with dates between January and March.

[Assistant] SELECT api_key, customer_id, doctor_id FROM healthcare.patients WHERE created_at BETWEEN '2023-01-01' AND '2023-03-31';

[User] What is the count full_name for each api_key in patients?

[Assistant] SELECT api_key, COUNT(full_name) AS count_full_name FROM healthcare.patients GROUP BY api_key;


[User] List all patients.

[Assistant] SELECT * FROM healthcare.patients;

[User] Retrieve patients where customer_id LIKE 'A%'.

[Assistant] SELECT * FROM healthcare.patients WHERE customer_id LIKE 'A%';

[User] Return just 100 rows.

[Assistant] SELECT * FROM healthcare.patients WHERE customer_id LIKE 'A%' LIMIT 100;


[User] Show me api_key, joined_at, avatar for all patients.

[Assistant] SELECT api_key, joined_at, avatar FROM healthcare.patients;

[User] List patients with dates from last week.

[Assistant] SELECT api_key, joined_at, avatar FROM healthcare.patients WHERE joined_at >= CURRENT_DATE - INTERVAL '7 days';

[User] Tally up patients by customer_id.

[Assistant] SELECT customer_id, COUNT(*) AS count FROM healthcare.patients GROUP BY customer_id ORDER BY count DESC;


[User] Retrieve all patients.

[Assistant] SELECT * FROM healthcare.patients;

[User] Show me created_at, customer_id, coordinates, category from patients and their related doctors.

[Assistant] SELECT *, doctors.coordinates, doctors.category FROM healthcare.patients JOIN healthcare.doctors ON patients.doctor_id = doctors.location_id;

[User] Show me the count of patients grouped by doctor_id.

[Assistant] SELECT doctor_id, COUNT(*) AS count FROM healthcare.patients GROUP BY doctor_id ORDER BY count DESC;


System:
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE socialmedia.likes (
  product_id varchar PRIMARY KEY -- unique identifier,
  updated_at date,
  reserved character varying(128),
  popularity_score char,
  quantity character varying(256)
)

CREATE TABLE socialmedia.groups (
  customer_id character varying(64) NOT NULL -- unique identifier,
  created_at timestamp without time zone,
  token char,
  bio character varying(64),
  gender text NOT NULL,
  like_id text -- reference to likes.product_id,
  FOREIGN KEY (like_id) REFERENCES likes(product_id)
)

[User] Display all groups.

[Assistant] SELECT * FROM socialmedia.groups;

[User] Show me groups that were created yesterday.

[Assistant] SELECT * FROM socialmedia.groups WHERE created_at = CURRENT_DATE - INTERVAL '1 day';

[User] Can you order these by token descending?

[Assistant] SELECT * FROM socialmedia.groups WHERE created_at = CURRENT_DATE - INTERVAL '1 day' ORDER BY token DESC;


[User] Display all groups.

[Assistant] SELECT * FROM socialmedia.groups;

[User] Retrieve customer_id, like_id, quantity, popularity_score showing the relationship between groups and likes.

[Assistant] SELECT *, likes.quantity, likes.popularity_score FROM socialmedia.groups JOIN socialmedia.likes ON groups.like_id = likes.product_id;

[User] Calculate sum of like_id for each gender in groups.

[Assistant] SELECT gender, SUM(like_id) AS sum_like_id FROM socialmedia.groups GROUP BY gender;


[User] Get all groups.

[Assistant] SELECT * FROM socialmedia.groups;

[User] Retrieve like_id, token, reserved, quantity showing the relationship between groups and likes.

[Assistant] SELECT *, likes.reserved, likes.quantity FROM socialmedia.groups JOIN socialmedia.likes ON groups.like_id = likes.product_id;

[User] Count the number of groups in each created_at category.

[Assistant] SELECT created_at, COUNT(*) AS count FROM socialmedia.groups GROUP BY created_at ORDER BY count DESC;


[User] Get all groups.

[Assistant] SELECT * FROM socialmedia.groups;

[User] List groups with dates modified within the last hour.

[Assistant] SELECT * FROM socialmedia.groups WHERE created_at >= CURRENT_TIMESTAMP - INTERVAL '1 hour';

[User] What is the max token for each like_id in groups?

[Assistant] SELECT like_id, MAX(token) AS max_token FROM socialmedia.groups GROUP BY like_id;


[User] Get token, customer_id, created_at from all groups.

[Assistant] SELECT token, customer_id, created_at FROM socialmedia.groups;

[User] Get groups that match customer_id LIKE 'A%'.

[Assistant] SELECT token, customer_id, created_at FROM socialmedia.groups WHERE customer_id LIKE 'A%';

[User] Can you order these by bio descending?

[Assistant] SELECT token, customer_id, created_at FROM socialmedia.groups WHERE customer_id LIKE 'A%' ORDER BY bio DESC;


[User] Retrieve bio, like_id, customer_id for every group.

[Assistant] SELECT bio, like_id, customer_id FROM socialmedia.groups;

[User] Get customer_id, created_at, reserved, updated_at by joining groups with likes.

[Assistant] SELECT bio, like_id, customer_id, likes.reserved, likes.updated_at FROM socialmedia.groups JOIN socialmedia.likes ON groups.like_id = likes.product_id;

[User] Show me the count of groups grouped by bio.

[Assistant] SELECT bio, COUNT(*) AS count FROM socialmedia.groups GROUP BY bio ORDER BY count DESC;


[User] Retrieve all groups.

[Assistant] SELECT * FROM socialmedia.groups;

[User] Get groups that match like_id LIKE 'A%'.

[Assistant] SELECT * FROM socialmedia.groups WHERE like_id LIKE 'A%';

[User] Limit the results to 25 rows.

[Assistant] SELECT * FROM socialmedia.groups WHERE like_id LIKE 'A%' LIMIT 25;


[User] Show me all groups.

[Assistant] SELECT * FROM socialmedia.groups;

[User] Find groups where gender LIKE 'A%'.

[Assistant] SELECT * FROM socialmedia.groups WHERE gender LIKE 'A%';

[User] How many groups are there per customer_id?

[Assistant] SELECT customer_id, COUNT(*) AS count FROM socialmedia.groups GROUP BY customer_id ORDER BY count DESC;


[User] Get all groups.

[Assistant] SELECT * FROM socialmedia.groups;

[User] Show me customer_id, bio, quantity, updated_at from groups and their related likes.

[Assistant] SELECT *, likes.quantity, likes.updated_at FROM socialmedia.groups JOIN socialmedia.likes ON groups.like_id = likes.product_id;

[User] Can you order these by customer_id ascending?

[Assistant] SELECT *, likes.quantity, likes.updated_at FROM socialmedia.groups JOIN socialmedia.likes ON groups.like_id = likes.product_id ORDER BY customer_id ASC;


[User] Retrieve all groups.

[Assistant] SELECT * FROM socialmedia.groups;

[User] Retrieve groups where customer_id LIKE 'A%'.

[Assistant] SELECT * FROM socialmedia.groups WHERE customer_id LIKE 'A%';

[User] Can you order these by gender descending?

[Assistant] SELECT * FROM socialmedia.groups WHERE customer_id LIKE 'A%' ORDER BY gender DESC;


System:
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE education.courses (
  venue_id varchar PRIMARY KEY -- unique identifier,
  last_inspected date,
  created_at timestamp,
  geo_point varchar NOT NULL,
  postal_code text,
  name character varying(256),
  location_lat character varying(64),
  operating_hours text NOT NULL,
  coordinates text,
  department_id integer NOT NULL -- reference to departments.payment_id,
  FOREIGN KEY (department_id) REFERENCES departments(payment_id)
)

CREATE TABLE education.departments (
  payment_id integer PRIMARY KEY -- unique identifier,
  updated_at timestamp,
  payer_id character varying(128),
  invoice_number character varying(64),
  payee_id varchar NOT NULL -- identifier for payee,
  amount decimal NOT NULL,
  category text NOT NULL,
  reference_number character varying(256) NOT NULL
)

CREATE TABLE education.enrollments (
  order_id varchar PRIMARY KEY -- unique identifier,
  traded_at timestamp,
  user_id character varying(64) NOT NULL -- identifier for user,
  exchange_rate character varying(128),
  customer_id text,
  status character varying(256),
  course_id text -- reference to courses.venue_id,
  FOREIGN KEY (course_id) REFERENCES courses(venue_id)
)

[User] List user_id, customer_id, traded_at from enrollments.

[Assistant] SELECT user_id, customer_id, traded_at FROM education.enrollments;

[User] Show me enrollments that were modified within the last hour.

[Assistant] SELECT user_id, customer_id, traded_at FROM education.enrollments WHERE traded_at >= CURRENT_TIMESTAMP - INTERVAL '1 hour';

[User] Get the distribution of enrollments across different course_id values.

[Assistant] SELECT course_id, COUNT(*) AS count FROM education.enrollments GROUP BY course_id ORDER BY count DESC;


[User] Display all enrollments.

[Assistant] SELECT * FROM education.enrollments;

[User] Get all enrollments created in the last 30 days.

[Assistant] SELECT * FROM education.enrollments WHERE traded_at >= CURRENT_DATE - INTERVAL '30 days';

[User] Show me max of status grouped by customer_id for enrollments.

[Assistant] SELECT customer_id, MAX(status) AS max_status FROM education.enrollments GROUP BY customer_id;


[User] Get user_id, traded_at, customer_id from all enrollments.

[Assistant] SELECT user_id, traded_at, customer_id FROM education.enrollments;

[User] Retrieve enrollments where the date is created yesterday.

[Assistant] SELECT user_id, traded_at, customer_id FROM education.enrollments WHERE traded_at = CURRENT_DATE - INTERVAL '1 day';

[User] What is the sum status for each course_id in enrollments?

[Assistant] SELECT course_id, SUM(status) AS sum_status FROM education.enrollments GROUP BY course_id;


[User] List exchange_rate, course_id, traded_at from enrollments.

[Assistant] SELECT exchange_rate, course_id, traded_at FROM education.enrollments;

[User] Can you order these by course_id descending?

[Assistant] SELECT exchange_rate, course_id, traded_at FROM education.enrollments ORDER BY course_id DESC;

[User] Can you order these by exchange_rate ascending?

[Assistant] SELECT exchange_rate, course_id, traded_at FROM education.enrollments ORDER BY exchange_rate ASC;


[User] Get course_id, customer_id, exchange_rate from all enrollments.

[Assistant] SELECT course_id, customer_id, exchange_rate FROM education.enrollments;

[User] List enrollments that have user_id LIKE 'A%'.

[Assistant] SELECT course_id, customer_id, exchange_rate FROM education.enrollments WHERE user_id LIKE 'A%';

[User] Show me sum of exchange_rate grouped by customer_id for enrollments.

[Assistant] SELECT customer_id, SUM(exchange_rate) AS sum_exchange_rate FROM education.enrollments GROUP BY customer_id;


[User] Show me all enrollments.

[Assistant] SELECT * FROM education.enrollments;

[User] Find enrollments between January and March.

[Assistant] SELECT * FROM education.enrollments WHERE traded_at BETWEEN '2023-01-01' AND '2023-03-31';

[User] What is the sum exchange_rate for each user_id in enrollments?

[Assistant] SELECT user_id, SUM(exchange_rate) AS sum_exchange_rate FROM education.enrollments GROUP BY user_id;


[User] Display all enrollments.

[Assistant] SELECT * FROM education.enrollments;

[User] Can you order these by user_id descending?

[Assistant] SELECT * FROM education.enrollments ORDER BY user_id DESC;

[User] Show the results sorted by course_id descending.

[Assistant] SELECT * FROM education.enrollments ORDER BY course_id DESC;


[User] List all courses.

[Assistant] SELECT * FROM education.courses;

[User] Show me courses with operating_hours LIKE 'A%'.

[Assistant] SELECT * FROM education.courses WHERE operating_hours LIKE 'A%';

[User] Show only 20 records.

[Assistant] SELECT * FROM education.courses WHERE operating_hours LIKE 'A%' LIMIT 20;


[User] Display all courses.

[Assistant] SELECT * FROM education.courses;

[User] Order the output by operating_hours ascending.

[Assistant] SELECT * FROM education.courses ORDER BY operating_hours ASC;

[User] Tally up courses by last_inspected.

[Assistant] SELECT last_inspected, COUNT(*) AS count FROM education.courses GROUP BY last_inspected ORDER BY count DESC;


[User] Display all courses.

[Assistant] SELECT * FROM education.courses;

[User] Get operating_hours, created_at, reference_number, amount by joining courses with departments.

[Assistant] SELECT *, departments.reference_number, departments.amount FROM education.courses JOIN education.departments ON courses.department_id = departments.payment_id;

[User] Get the distribution of courses across different coordinates values.

[Assistant] SELECT coordinates, COUNT(*) AS count FROM education.courses GROUP BY coordinates ORDER BY count DESC;


System:
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE healthcare.patients (
  user_id character varying(64) NOT NULL -- unique identifier,
  created_at timestamp without time zone,
  last_name varchar,
  age varchar,
  last_login timestamp,
  zip_code text NOT NULL,
  avatar char NOT NULL,
  appointment_id text -- reference to appointments.payment_id,
  FOREIGN KEY (appointment_id) REFERENCES appointments(payment_id)
)

CREATE TABLE healthcare.appointments (
  payment_id varchar PRIMARY KEY -- unique identifier,
  created_at timestamp,
  notes char,
  balance decimal,
  category varchar,
  reconciliation_status varchar NOT NULL,
  credit character varying(64)
)

[User] Show me last_login, appointment_id, created_at for all patients.

[Assistant] SELECT last_login, appointment_id, created_at FROM healthcare.patients;

[User] Show me patients that were modified within the last hour.

[Assistant] SELECT last_login, appointment_id, created_at FROM healthcare.patients WHERE last_login >= CURRENT_TIMESTAMP - INTERVAL '1 hour';

[User] Show me sum of zip_code grouped by user_id for patients.

[Assistant] SELECT user_id, SUM(zip_code) AS sum_zip_code FROM healthcare.patients GROUP BY user_id;


[User] Show me all patients.

[Assistant] SELECT * FROM healthcare.patients;

[User] Retrieve last_login, age, balance, reconciliation_status showing the relationship between patients and appointments.

[Assistant] SELECT *, appointments.balance, appointments.reconciliation_status FROM healthcare.patients JOIN healthcare.appointments ON patients.appointment_id = appointments.payment_id;

[User] Sort the results by last_login ascending.

[Assistant] SELECT *, appointments.balance, appointments.reconciliation_status FROM healthcare.patients JOIN healthcare.appointments ON patients.appointment_id = appointments.payment_id ORDER BY last_login ASC;


[User] Get all patients.

[Assistant] SELECT * FROM healthcare.patients;

[User] Order the output by created_at descending.

[Assistant] SELECT * FROM healthcare.patients ORDER BY created_at DESC;

[User] How many patients are there per last_login?

[Assistant] SELECT last_login, COUNT(*) AS count FROM healthcare.patients GROUP BY last_login ORDER BY count DESC;


[User] Get created_at, last_name, age from all patients.

[Assistant] SELECT created_at, last_name, age FROM healthcare.patients;

[User] List patients that have user_id LIKE 'A%'.

[Assistant] SELECT created_at, last_name, age FROM healthcare.patients WHERE user_id LIKE 'A%';

[User] Return just 50 rows.

[Assistant] SELECT created_at, last_name, age FROM healthcare.patients WHERE user_id LIKE 'A%' LIMIT 50;


[User] List all patients.

[Assistant] SELECT * FROM healthcare.patients;

[User] What zip_code, last_name, balance, credit do we have for patients and their associated appointments?

[Assistant] SELECT *, appointments.balance, appointments.credit FROM healthcare.patients JOIN healthcare.appointments ON patients.appointment_id = appointments.payment_id;

[User] Group patients by last_name and show the average of age.

[Assistant] SELECT last_name, AVERAGE(age) AS average_age FROM healthcare.patients GROUP BY last_name;


[User] Retrieve all patients.

[Assistant] SELECT * FROM healthcare.patients;

[User] Get patients that match age LIKE 'A%'.

[Assistant] SELECT * FROM healthcare.patients WHERE age LIKE 'A%';

[User] Restrict the output to 20 items.

[Assistant] SELECT * FROM healthcare.patients WHERE age LIKE 'A%' LIMIT 20;


[User] What are the age, zip_code, last_name of each patient?

[Assistant] SELECT age, zip_code, last_name FROM healthcare.patients;

[User] Sort the results by last_name descending.

[Assistant] SELECT age, zip_code, last_name FROM healthcare.patients ORDER BY last_name DESC;

[User] Restrict the output to 10 items.

[Assistant] SELECT age, zip_code, last_name FROM healthcare.patients ORDER BY last_name DESC LIMIT 10;


[User] Get all patients.

[Assistant] SELECT * FROM healthcare.patients;

[User] Get patients that match appointment_id LIKE 'A%'.

[Assistant] SELECT * FROM healthcare.patients WHERE appointment_id LIKE 'A%';

[User] Can you order these by zip_code ascending?

[Assistant] SELECT * FROM healthcare.patients WHERE appointment_id LIKE 'A%' ORDER BY zip_code ASC;


[User] List all patients.

[Assistant] SELECT * FROM healthcare.patients;

[User] List patients with dates modified within the last hour.

[Assistant] SELECT * FROM healthcare.patients WHERE created_at >= CURRENT_TIMESTAMP - INTERVAL '1 hour';

[User] Calculate count of age for each created_at in patients.

[Assistant] SELECT created_at, COUNT(age) AS count_age FROM healthcare.patients GROUP BY created_at;


[User] Get all patients.

[Assistant] SELECT * FROM healthcare.patients;

[User] Can you order these by appointment_id descending?

[Assistant] SELECT * FROM healthcare.patients ORDER BY appointment_id DESC;

[User] Get sum of created_at by age from patients.

[Assistant] SELECT age, SUM(created_at) AS sum_created_at FROM healthcare.patients GROUP BY age;


System:
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE tradingplatform.logs (
  invoice_id varchar PRIMARY KEY -- unique identifier,
  updated_at timestamp without time zone,
  user_id varchar,
  payee_id text -- identifier for payee,
  approval_status char,
  payer_id text NOT NULL -- identifier for payer,
  vendor_id text -- identifier for vendor,
  notification_id integer NOT NULL -- reference to notifications.barcode,
  FOREIGN KEY (notification_id) REFERENCES notifications(barcode)
)

CREATE TABLE tradingplatform.notifications (
  barcode integer PRIMARY KEY -- unique identifier,
  updated_at timestamp without time zone,
  reserved text NOT NULL,
  thumbnail_url character varying(128),
  price numeric(38,14),
  rating char
)

CREATE TABLE tradingplatform.trades (
  order_id character varying(64) NOT NULL -- unique identifier,
  updated_at timestamp,
  buyer_id character varying(128) NOT NULL -- identifier for buyer,
  delivery_status character varying(64) NOT NULL,
  customer_id text,
  notification_id integer -- reference to notifications.barcode,
  log_id text -- reference to logs.invoice_id,
  FOREIGN KEY (notification_id) REFERENCES notifications(barcode),
  FOREIGN KEY (log_id) REFERENCES logs(invoice_id)
)

[User] Display all trades.

[Assistant] SELECT * FROM tradingplatform.trades;

[User] Order the output by log_id ascending.

[Assistant] SELECT * FROM tradingplatform.trades ORDER BY log_id ASC;

[User] Show me count of order_id grouped by notification_id for trades.

[Assistant] SELECT notification_id, COUNT(order_id) AS count_order_id FROM tradingplatform.trades GROUP BY notification_id;


[User] Get vendor_id, updated_at, notification_id from all logs.

[Assistant] SELECT vendor_id, updated_at, notification_id FROM tradingplatform.logs;

[User] Retrieve logs where user_id LIKE 'A%'.

[Assistant] SELECT vendor_id, updated_at, notification_id FROM tradingplatform.logs WHERE user_id LIKE 'A%';

[User] Can you order these by updated_at descending?

[Assistant] SELECT vendor_id, updated_at, notification_id FROM tradingplatform.logs WHERE user_id LIKE 'A%' ORDER BY updated_at DESC;


[User] List all logs.

[Assistant] SELECT * FROM tradingplatform.logs;

[User] List payer_id, approval_status, price, rating for each log along with their notification information.

[Assistant] SELECT *, notifications.price, notifications.rating FROM tradingplatform.logs JOIN tradingplatform.notifications ON logs.notification_id = notifications.barcode;

[User] Sort the results by payee_id ascending.

[Assistant] SELECT *, notifications.price, notifications.rating FROM tradingplatform.logs JOIN tradingplatform.notifications ON logs.notification_id = notifications.barcode ORDER BY payee_id ASC;


[User] Get all trades.

[Assistant] SELECT * FROM tradingplatform.trades;

[User] Retrieve trades where log_id LIKE 'A%'.

[Assistant] SELECT * FROM tradingplatform.trades WHERE log_id LIKE 'A%';

[User] Order the output by customer_id ascending.

[Assistant] SELECT * FROM tradingplatform.trades WHERE log_id LIKE 'A%' ORDER BY customer_id ASC;


[User] List customer_id, updated_at, delivery_status from trades.

[Assistant] SELECT customer_id, updated_at, delivery_status FROM tradingplatform.trades;

[User] Order the output by delivery_status descending.

[Assistant] SELECT customer_id, updated_at, delivery_status FROM tradingplatform.trades ORDER BY delivery_status DESC;

[User] How many trades are there per log_id?

[Assistant] SELECT log_id, COUNT(*) AS count FROM tradingplatform.trades GROUP BY log_id ORDER BY count DESC;


[User] Get vendor_id, payer_id, user_id from all logs.

[Assistant] SELECT vendor_id, payer_id, user_id FROM tradingplatform.logs;

[User] Find logs where payer_id LIKE 'A%'.

[Assistant] SELECT vendor_id, payer_id, user_id FROM tradingplatform.logs WHERE payer_id LIKE 'A%';

[User] Calculate count of user_id for each notification_id in logs.

[Assistant] SELECT notification_id, COUNT(user_id) AS count_user_id FROM tradingplatform.logs GROUP BY notification_id;


[User] Show me all trades.

[Assistant] SELECT * FROM tradingplatform.trades;

[User] Get updated_at, log_id, price, reserved by joining trades with notifications.

[Assistant] SELECT *, notifications.price, notifications.reserved FROM tradingplatform.trades JOIN tradingplatform.notifications ON trades.notification_id = notifications.barcode;

[User] Show me the count of trades grouped by customer_id.

[Assistant] SELECT customer_id, COUNT(*) AS count FROM tradingplatform.trades GROUP BY customer_id ORDER BY count DESC;


[User] Display all trades.

[Assistant] SELECT * FROM tradingplatform.trades;

[User] Can you order these by updated_at ascending?

[Assistant] SELECT * FROM tradingplatform.trades ORDER BY updated_at ASC;

[User] Get average of buyer_id by log_id from trades.

[Assistant] SELECT log_id, AVERAGE(buyer_id) AS average_buyer_id FROM tradingplatform.trades GROUP BY log_id;


[User] Show me customer_id, updated_at, order_id for all trades.

[Assistant] SELECT customer_id, updated_at, order_id FROM tradingplatform.trades;

[User] Get all trades created in the last 30 days.

[Assistant] SELECT customer_id, updated_at, order_id FROM tradingplatform.trades WHERE updated_at >= CURRENT_DATE - INTERVAL '30 days';

[User] Return just 50 rows.

[Assistant] SELECT customer_id, updated_at, order_id FROM tradingplatform.trades WHERE updated_at >= CURRENT_DATE - INTERVAL '30 days' LIMIT 50;


[User] Show me vendor_id, payee_id, approval_status for all logs.

[Assistant] SELECT vendor_id, payee_id, approval_status FROM tradingplatform.logs;

[User] List updated_at, notification_id, price, thumbnail_url for each log along with their notification information.

[Assistant] SELECT vendor_id, payee_id, approval_status, notifications.price, notifications.thumbnail_url FROM tradingplatform.logs JOIN tradingplatform.notifications ON logs.notification_id = notifications.barcode;

[User] How many logs are there per vendor_id?

[Assistant] SELECT vendor_id, COUNT(*) AS count FROM tradingplatform.logs GROUP BY vendor_id ORDER BY count DESC;


System:
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE retail.patients (
  id text PRIMARY KEY -- unique identifier,
  created_at timestamp without time zone,
  city character varying(64),
  is_active boolean NOT NULL,
  country character varying(64) NOT NULL,
  full_name char
)

CREATE TABLE retail.inventory (
  id character varying(64) NOT NULL -- unique identifier,
  created_at timestamp without time zone,
  published_at timestamp,
  video_url varchar,
  tax_rate character varying(256) NOT NULL,
  popularity_score char,
  available varchar,
  subcategory text,
  views char
)

[User] Retrieve all inventory.

[Assistant] SELECT * FROM retail.inventory;

[User] Order the output by available descending.

[Assistant] SELECT * FROM retail.inventory ORDER BY available DESC;

[User] Group inventory by published_at and show the sum of available.

[Assistant] SELECT published_at, SUM(available) AS sum_available FROM retail.inventory GROUP BY published_at;


[User] Retrieve city, is_active, country for every patient.

[Assistant] SELECT city, is_active, country FROM retail.patients;

[User] Show me patients that were between January and March.

[Assistant] SELECT city, is_active, country FROM retail.patients WHERE created_at BETWEEN '2023-01-01' AND '2023-03-31';

[User] Get the distribution of patients across different city values.

[Assistant] SELECT city, COUNT(*) AS count FROM retail.patients GROUP BY city ORDER BY count DESC;


[User] List full_name, country, created_at from patients.

[Assistant] SELECT full_name, country, created_at FROM retail.patients;

[User] List patients that have country LIKE 'A%'.

[Assistant] SELECT full_name, country, created_at FROM retail.patients WHERE country LIKE 'A%';

[User] Show me count of created_at grouped by city for patients.

[Assistant] SELECT city, COUNT(created_at) AS count_created_at FROM retail.patients GROUP BY city;


[User] What are the is_active, created_at, city of each patient?

[Assistant] SELECT is_active, created_at, city FROM retail.patients;

[User] Can you order these by is_active ascending?

[Assistant] SELECT is_active, created_at, city FROM retail.patients ORDER BY is_active ASC;

[User] Group patients by created_at and show the count of city.

[Assistant] SELECT created_at, COUNT(city) AS count_city FROM retail.patients GROUP BY created_at;


[User] Show me published_at, popularity_score, subcategory for all inventory.

[Assistant] SELECT published_at, popularity_score, subcategory FROM retail.inventory;

[User] List inventory with dates created after December 1st, 2023.

[Assistant] SELECT published_at, popularity_score, subcategory FROM retail.inventory WHERE created_at > '2023-12-01';

[User] Order the output by available ascending.

[Assistant] SELECT published_at, popularity_score, subcategory FROM retail.inventory WHERE created_at > '2023-12-01' ORDER BY available ASC;


[User] Get all patients.

[Assistant] SELECT * FROM retail.patients;

[User] Find patients between January and March.

[Assistant] SELECT * FROM retail.patients WHERE created_at BETWEEN '2023-01-01' AND '2023-03-31';

[User] What is the count country for each city in patients?

[Assistant] SELECT city, COUNT(country) AS count_country FROM retail.patients GROUP BY city;


[User] What are the city, full_name, country of each patient?

[Assistant] SELECT city, full_name, country FROM retail.patients;

[User] Get all patients older than 6 months.

[Assistant] SELECT city, full_name, country FROM retail.patients WHERE created_at <= CURRENT_DATE - INTERVAL '6 months';

[User] Calculate sum of full_name for each full_name in patients.

[Assistant] SELECT full_name, SUM(full_name) AS sum_full_name FROM retail.patients GROUP BY full_name;


[User] Get created_at, is_active, full_name from all patients.

[Assistant] SELECT created_at, is_active, full_name FROM retail.patients;

[User] Get all patients modified within the last hour.

[Assistant] SELECT created_at, is_active, full_name FROM retail.patients WHERE created_at >= CURRENT_TIMESTAMP - INTERVAL '1 hour';

[User] Count the number of patients in each full_name category.

[Assistant] SELECT full_name, COUNT(*) AS count FROM retail.patients GROUP BY full_name ORDER BY count DESC;


[User] List all patients.

[Assistant] SELECT * FROM retail.patients;

[User] Can you order these by is_active ascending?

[Assistant] SELECT * FROM retail.patients ORDER BY is_active ASC;

[User] Only show the top 100 results.

[Assistant] SELECT * FROM retail.patients ORDER BY is_active ASC LIMIT 100;


[User] Get all patients.

[Assistant] SELECT * FROM retail.patients;

[User] Show me patients with created_at > '2023-01-01'.

[Assistant] SELECT * FROM retail.patients WHERE created_at > '2023-01-01';

[User] Arrange the results with city in descending order.

[Assistant] SELECT * FROM retail.patients WHERE created_at > '2023-01-01' ORDER BY city DESC;


System:
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE restaurant.products (
  item_id character varying(64) NOT NULL -- unique identifier,
  published_at timestamp without time zone,
  expires_at timestamp without time zone,
  backorder character varying(128),
  available text NOT NULL,
  rating character varying(256) NOT NULL,
  discount decimal NOT NULL,
  name character varying(256),
  quantity character varying(64),
  video_url character varying(128) NOT NULL -- identifier for video_url,
  finance_id text -- reference to finances.account_id,
  FOREIGN KEY (finance_id) REFERENCES finances(account_id)
)

CREATE TABLE restaurant.finances (
  account_id varchar PRIMARY KEY -- unique identifier,
  created_at timestamp,
  payment_date timestamp,
  category char NOT NULL,
  debit character varying(128) NOT NULL,
  vendor_id text NOT NULL,
  payee_id character varying(256),
  verification_status character varying(256),
  currency varchar NOT NULL
)

[User] List discount, rating, expires_at from products.

[Assistant] SELECT discount, rating, expires_at FROM restaurant.products;

[User] Retrieve products where the date is between January and March.

[Assistant] SELECT discount, rating, expires_at FROM restaurant.products WHERE expires_at BETWEEN '2023-01-01' AND '2023-03-31';

[User] Can you order these by item_id descending?

[Assistant] SELECT discount, rating, expires_at FROM restaurant.products WHERE expires_at BETWEEN '2023-01-01' AND '2023-03-31' ORDER BY item_id DESC;


[User] Show me all products.

[Assistant] SELECT * FROM restaurant.products;

[User] List products with dates created yesterday.

[Assistant] SELECT * FROM restaurant.products WHERE expires_at = CURRENT_DATE - INTERVAL '1 day';

[User] Show only 10 records.

[Assistant] SELECT * FROM restaurant.products WHERE expires_at = CURRENT_DATE - INTERVAL '1 day' LIMIT 10;


[User] Get all products.

[Assistant] SELECT * FROM restaurant.products;

[User] Can you order these by backorder ascending?

[Assistant] SELECT * FROM restaurant.products ORDER BY backorder ASC;

[User] Tally up products by available.

[Assistant] SELECT available, COUNT(*) AS count FROM restaurant.products GROUP BY available ORDER BY count DESC;


[User] Get all products.

[Assistant] SELECT * FROM restaurant.products;

[User] List quantity, name, created_at, debit for each product along with their finance information.

[Assistant] SELECT *, finances.created_at, finances.debit FROM restaurant.products JOIN restaurant.finances ON products.finance_id = finances.account_id;

[User] Limit the results to 100 rows.

[Assistant] SELECT *, finances.created_at, finances.debit FROM restaurant.products JOIN restaurant.finances ON products.finance_id = finances.account_id LIMIT 100;


[User] List all products.

[Assistant] SELECT * FROM restaurant.products;

[User] Find products created yesterday.

[Assistant] SELECT * FROM restaurant.products WHERE expires_at = CURRENT_DATE - INTERVAL '1 day';

[User] Restrict the output to 10 items.

[Assistant] SELECT * FROM restaurant.products WHERE expires_at = CURRENT_DATE - INTERVAL '1 day' LIMIT 10;


[User] Show me item_id, finance_id, rating for all products.

[Assistant] SELECT item_id, finance_id, rating FROM restaurant.products;

[User] Get video_url, finance_id, debit, currency by joining products with finances.

[Assistant] SELECT item_id, finance_id, rating, finances.debit, finances.currency FROM restaurant.products JOIN restaurant.finances ON products.finance_id = finances.account_id;

[User] How many products are there per backorder?

[Assistant] SELECT backorder, COUNT(*) AS count FROM restaurant.products GROUP BY backorder ORDER BY count DESC;


[User] Retrieve all products.

[Assistant] SELECT * FROM restaurant.products;

[User] Show me products that were older than 6 months.

[Assistant] SELECT * FROM restaurant.products WHERE expires_at <= CURRENT_DATE - INTERVAL '6 months';

[User] Restrict the output to 15 items.

[Assistant] SELECT * FROM restaurant.products WHERE expires_at <= CURRENT_DATE - INTERVAL '6 months' LIMIT 15;


[User] Get all products.

[Assistant] SELECT * FROM restaurant.products;

[User] Retrieve products where rating LIKE 'A%'.

[Assistant] SELECT * FROM restaurant.products WHERE rating LIKE 'A%';

[User] Show the results sorted by video_url descending.

[Assistant] SELECT * FROM restaurant.products WHERE rating LIKE 'A%' ORDER BY video_url DESC;


[User] Get finance_id, backorder, quantity from all products.

[Assistant] SELECT finance_id, backorder, quantity FROM restaurant.products;

[User] Get backorder, video_url, created_at, vendor_id by joining products with finances.

[Assistant] SELECT finance_id, backorder, quantity, finances.created_at, finances.vendor_id FROM restaurant.products JOIN restaurant.finances ON products.finance_id = finances.account_id;

[User] Arrange the results with quantity in descending order.

[Assistant] SELECT finance_id, backorder, quantity, finances.created_at, finances.vendor_id FROM restaurant.products JOIN restaurant.finances ON products.finance_id = finances.account_id ORDER BY quantity DESC;


[User] Get expires_at, discount, finance_id from all products.

[Assistant] SELECT expires_at, discount, finance_id FROM restaurant.products;

[User] Show me products that were older than 6 months.

[Assistant] SELECT expires_at, discount, finance_id FROM restaurant.products WHERE published_at <= CURRENT_DATE - INTERVAL '6 months';

[User] Show me the count of products grouped by available.

[Assistant] SELECT available, COUNT(*) AS count FROM restaurant.products GROUP BY available ORDER BY count DESC;


System:
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE e-commerce.inventory (
  sku integer PRIMARY KEY -- unique identifier,
  published_at timestamp,
  tax_rate char,
  currency text NOT NULL,
  featured_rank char,
  thumbnail_url char,
  popularity_score varchar NOT NULL,
  cost decimal,
  user_id integer NOT NULL -- reference to users.id,
  FOREIGN KEY (user_id) REFERENCES users(id)
)

CREATE TABLE e-commerce.users (
  id integer PRIMARY KEY -- unique identifier,
  created_at timestamp without time zone,
  last_active date,
  age varchar,
  account_status character varying(128) NOT NULL,
  timezone character varying(128),
  inventor_id integer NOT NULL -- reference to inventory.sku,
  FOREIGN KEY (inventor_id) REFERENCES inventory(sku)
)

[User] Show me all users.

[Assistant] SELECT * FROM e-commerce.users;

[User] Get users that match timezone LIKE 'A%'.

[Assistant] SELECT * FROM e-commerce.users WHERE timezone LIKE 'A%';

[User] Sort the results by inventor_id descending.

[Assistant] SELECT * FROM e-commerce.users WHERE timezone LIKE 'A%' ORDER BY inventor_id DESC;


[User] Get all inventory.

[Assistant] SELECT * FROM e-commerce.inventory;

[User] Find inventory where popularity_score LIKE 'A%'.

[Assistant] SELECT * FROM e-commerce.inventory WHERE popularity_score LIKE 'A%';

[User] Only show the top 25 results.

[Assistant] SELECT * FROM e-commerce.inventory WHERE popularity_score LIKE 'A%' LIMIT 25;


[User] What are the timezone, last_active, account_status of each user?

[Assistant] SELECT timezone, last_active, account_status FROM e-commerce.users;

[User] Show me account_status, last_active, featured_rank, tax_rate from users and their related inventory.

[Assistant] SELECT timezone, last_active, account_status, inventory.featured_rank, inventory.tax_rate FROM e-commerce.users JOIN e-commerce.inventory ON users.inventor_id = inventory.sku;

[User] Get sum of last_active by timezone from users.

[Assistant] SELECT timezone, SUM(last_active) AS sum_last_active FROM e-commerce.users GROUP BY timezone;


[User] Get timezone, account_status, inventor_id from all users.

[Assistant] SELECT timezone, account_status, inventor_id FROM e-commerce.users;

[User] Find users created in the last 30 days.

[Assistant] SELECT timezone, account_status, inventor_id FROM e-commerce.users WHERE created_at >= CURRENT_DATE - INTERVAL '30 days';

[User] Only show the top 100 results.

[Assistant] SELECT timezone, account_status, inventor_id FROM e-commerce.users WHERE created_at >= CURRENT_DATE - INTERVAL '30 days' LIMIT 100;


[User] List all users.

[Assistant] SELECT * FROM e-commerce.users;

[User] Show me users that were created yesterday.

[Assistant] SELECT * FROM e-commerce.users WHERE created_at = CURRENT_DATE - INTERVAL '1 day';

[User] Tally up users by created_at.

[Assistant] SELECT created_at, COUNT(*) AS count FROM e-commerce.users GROUP BY created_at ORDER BY count DESC;


[User] List all users.

[Assistant] SELECT * FROM e-commerce.users;

[User] Can you order these by created_at ascending?

[Assistant] SELECT * FROM e-commerce.users ORDER BY created_at ASC;

[User] Limit the results to 5 rows.

[Assistant] SELECT * FROM e-commerce.users ORDER BY created_at ASC LIMIT 5;


[User] Show me account_status, last_active, age for all users.

[Assistant] SELECT account_status, last_active, age FROM e-commerce.users;

[User] Can you order these by created_at ascending?

[Assistant] SELECT account_status, last_active, age FROM e-commerce.users ORDER BY created_at ASC;

[User] Order the output by account_status descending.

[Assistant] SELECT account_status, last_active, age FROM e-commerce.users ORDER BY account_status DESC;


[User] Get all inventory.

[Assistant] SELECT * FROM e-commerce.inventory;

[User] Retrieve inventory where the date is created after December 1st, 2023.

[Assistant] SELECT * FROM e-commerce.inventory WHERE published_at > '2023-12-01';

[User] Calculate min of popularity_score for each thumbnail_url in inventory.

[Assistant] SELECT thumbnail_url, MIN(popularity_score) AS min_popularity_score FROM e-commerce.inventory GROUP BY thumbnail_url;


[User] List thumbnail_url, published_at, user_id from inventory.

[Assistant] SELECT thumbnail_url, published_at, user_id FROM e-commerce.inventory;

[User] Retrieve inventory where the date is from last week.

[Assistant] SELECT thumbnail_url, published_at, user_id FROM e-commerce.inventory WHERE published_at >= CURRENT_DATE - INTERVAL '7 days';

[User] Get max of popularity_score by published_at from inventory.

[Assistant] SELECT published_at, MAX(popularity_score) AS max_popularity_score FROM e-commerce.inventory GROUP BY published_at;


[User] Retrieve account_status, age, timezone for every user.

[Assistant] SELECT account_status, age, timezone FROM e-commerce.users;

[User] Retrieve users where the date is created yesterday.

[Assistant] SELECT account_status, age, timezone FROM e-commerce.users WHERE last_active = CURRENT_DATE - INTERVAL '1 day';

[User] Sort the results by account_status descending.

[Assistant] SELECT account_status, age, timezone FROM e-commerce.users WHERE last_active = CURRENT_DATE - INTERVAL '1 day' ORDER BY account_status DESC;


System:
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE finance.accounts (
  transaction_id text PRIMARY KEY -- unique identifier,
  created_at timestamp without time zone,
  payment_date date,
  invoice_number character varying(256),
  description text NOT NULL,
  category text,
  investment_id integer NOT NULL -- reference to investments.location_id,
  FOREIGN KEY (investment_id) REFERENCES investments(location_id)
)

CREATE TABLE finance.payments (
  order_id integer PRIMARY KEY -- unique identifier,
  processed_at date,
  delivery_status char,
  approval_status text,
  quantity character varying(128) NOT NULL
)

CREATE TABLE finance.investments (
  location_id integer PRIMARY KEY -- unique identifier,
  last_inspected date,
  updated_at timestamp,
  postal_code varchar NOT NULL,
  parking_available character varying(64) NOT NULL,
  description text NOT NULL,
  operating_hours character varying(256),
  account_id text NOT NULL -- reference to accounts.transaction_id,
  FOREIGN KEY (account_id) REFERENCES accounts(transaction_id)
)

[User] List all investments.

[Assistant] SELECT * FROM finance.investments;

[User] Find investments where operating_hours LIKE 'A%'.

[Assistant] SELECT * FROM finance.investments WHERE operating_hours LIKE 'A%';

[User] Restrict the output to 50 items.

[Assistant] SELECT * FROM finance.investments WHERE operating_hours LIKE 'A%' LIMIT 50;


[User] Get all investments.

[Assistant] SELECT * FROM finance.investments;

[User] Show me investments with description LIKE 'A%'.

[Assistant] SELECT * FROM finance.investments WHERE description LIKE 'A%';

[User] Restrict the output to 25 items.

[Assistant] SELECT * FROM finance.investments WHERE description LIKE 'A%' LIMIT 25;


[User] List description, category, created_at from accounts.

[Assistant] SELECT description, category, created_at FROM finance.accounts;

[User] What category, created_at, account_id, last_inspected do we have for accounts and their associated investments?

[Assistant] SELECT description, category, created_at, investments.account_id, investments.last_inspected FROM finance.accounts JOIN finance.investments ON accounts.investment_id = investments.location_id;

[User] Return just 50 rows.

[Assistant] SELECT description, category, created_at, investments.account_id, investments.last_inspected FROM finance.accounts JOIN finance.investments ON accounts.investment_id = investments.location_id LIMIT 50;


[User] Show me all investments.

[Assistant] SELECT * FROM finance.investments;

[User] List investments that have operating_hours LIKE 'A%'.

[Assistant] SELECT * FROM finance.investments WHERE operating_hours LIKE 'A%';

[User] Sort the results by operating_hours descending.

[Assistant] SELECT * FROM finance.investments WHERE operating_hours LIKE 'A%' ORDER BY operating_hours DESC;


[User] Get all accounts.

[Assistant] SELECT * FROM finance.accounts;

[User] Show the results sorted by payment_date descending.

[Assistant] SELECT * FROM finance.accounts ORDER BY payment_date DESC;

[User] Only show the top 5 results.

[Assistant] SELECT * FROM finance.accounts ORDER BY payment_date DESC LIMIT 5;


[User] Get category, description, payment_date from all accounts.

[Assistant] SELECT category, description, payment_date FROM finance.accounts;

[User] Get created_at, payment_date, last_inspected, postal_code by joining accounts with investments.

[Assistant] SELECT category, description, payment_date, investments.last_inspected, investments.postal_code FROM finance.accounts JOIN finance.investments ON accounts.investment_id = investments.location_id;

[User] Show me average of invoice_number grouped by investment_id for accounts.

[Assistant] SELECT investment_id, AVERAGE(invoice_number) AS average_invoice_number FROM finance.accounts GROUP BY investment_id;


[User] What are the category, created_at, investment_id of each account?

[Assistant] SELECT category, created_at, investment_id FROM finance.accounts;

[User] Order the output by category ascending.

[Assistant] SELECT category, created_at, investment_id FROM finance.accounts ORDER BY category ASC;

[User] Show me the count of accounts grouped by investment_id.

[Assistant] SELECT investment_id, COUNT(*) AS count FROM finance.accounts GROUP BY investment_id ORDER BY count DESC;


[User] Get all investments.

[Assistant] SELECT * FROM finance.investments;

[User] Get investments that match last_inspected > '2023-01-01'.

[Assistant] SELECT * FROM finance.investments WHERE last_inspected > '2023-01-01';

[User] Calculate count of description for each postal_code in investments.

[Assistant] SELECT postal_code, COUNT(description) AS count_description FROM finance.investments GROUP BY postal_code;


[User] Get all investments.

[Assistant] SELECT * FROM finance.investments;

[User] Retrieve description, updated_at, payment_date, investment_id showing the relationship between investments and accounts.

[Assistant] SELECT *, accounts.payment_date, accounts.investment_id FROM finance.investments JOIN finance.accounts ON investments.account_id = accounts.transaction_id;

[User] Tally up investments by parking_available.

[Assistant] SELECT parking_available, COUNT(*) AS count FROM finance.investments GROUP BY parking_available ORDER BY count DESC;


[User] Show me operating_hours, description, account_id for all investments.

[Assistant] SELECT operating_hours, description, account_id FROM finance.investments;

[User] Find investments created yesterday.

[Assistant] SELECT operating_hours, description, account_id FROM finance.investments WHERE updated_at = CURRENT_DATE - INTERVAL '1 day';

[User] Calculate count of last_inspected for each postal_code in investments.

[Assistant] SELECT postal_code, COUNT(last_inspected) AS count_last_inspected FROM finance.investments GROUP BY postal_code;


System:
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE finance.investments (
  invoice_id text PRIMARY KEY -- unique identifier,
  created_at date,
  processed_at timestamp without time zone,
  customer_id text,
  exchange_rate character varying(256),
  verification_status character varying(64),
  amount decimal NOT NULL,
  debit character varying(128) NOT NULL,
  balance decimal
)

CREATE TABLE finance.customers (
  customer_id varchar PRIMARY KEY -- unique identifier,
  joined_at date,
  password_hash character varying(256),
  token text NOT NULL,
  first_name character varying(256),
  birth_date timestamp without time zone,
  is_active bit -- indicates if active is true,
  investment_id text -- reference to investments.invoice_id,
  FOREIGN KEY (investment_id) REFERENCES investments(invoice_id)
)

[User] Retrieve token, joined_at, first_name for every customer.

[Assistant] SELECT token, joined_at, first_name FROM finance.customers;

[User] Get all customers created after December 1st, 2023.

[Assistant] SELECT token, joined_at, first_name FROM finance.customers WHERE birth_date > '2023-12-01';

[User] Show me the count of customers grouped by password_hash.

[Assistant] SELECT password_hash, COUNT(*) AS count FROM finance.customers GROUP BY password_hash ORDER BY count DESC;


[User] Show me all customers.

[Assistant] SELECT * FROM finance.customers;

[User] Get customers that match joined_at > '2023-01-01'.

[Assistant] SELECT * FROM finance.customers WHERE joined_at > '2023-01-01';

[User] Show only 10 records.

[Assistant] SELECT * FROM finance.customers WHERE joined_at > '2023-01-01' LIMIT 10;


[User] Get first_name, token, joined_at from all customers.

[Assistant] SELECT first_name, token, joined_at FROM finance.customers;

[User] Find customers where first_name LIKE 'A%'.

[Assistant] SELECT first_name, token, joined_at FROM finance.customers WHERE first_name LIKE 'A%';

[User] What is the count joined_at for each joined_at in customers?

[Assistant] SELECT joined_at, COUNT(joined_at) AS count_joined_at FROM finance.customers GROUP BY joined_at;


[User] Get joined_at, token, password_hash from all customers.

[Assistant] SELECT joined_at, token, password_hash FROM finance.customers;

[User] Retrieve customers where the date is modified within the last hour.

[Assistant] SELECT joined_at, token, password_hash FROM finance.customers WHERE joined_at >= CURRENT_TIMESTAMP - INTERVAL '1 hour';

[User] Can you order these by investment_id ascending?

[Assistant] SELECT joined_at, token, password_hash FROM finance.customers WHERE joined_at >= CURRENT_TIMESTAMP - INTERVAL '1 hour' ORDER BY investment_id ASC;


[User] List all customers.

[Assistant] SELECT * FROM finance.customers;

[User] Get all customers older than 6 months.

[Assistant] SELECT * FROM finance.customers WHERE joined_at <= CURRENT_DATE - INTERVAL '6 months';

[User] Tally up customers by birth_date.

[Assistant] SELECT birth_date, COUNT(*) AS count FROM finance.customers GROUP BY birth_date ORDER BY count DESC;


[User] Get is_active, birth_date, investment_id from all customers.

[Assistant] SELECT is_active, birth_date, investment_id FROM finance.customers;

[User] Show me first_name, token, amount, debit from customers and their related investments.

[Assistant] SELECT is_active, birth_date, investment_id, investments.amount, investments.debit FROM finance.customers JOIN finance.investments ON customers.investment_id = investments.invoice_id;

[User] Return just 5 rows.

[Assistant] SELECT is_active, birth_date, investment_id, investments.amount, investments.debit FROM finance.customers JOIN finance.investments ON customers.investment_id = investments.invoice_id LIMIT 5;


[User] Show me all customers.

[Assistant] SELECT * FROM finance.customers;

[User] List investment_id, token, customer_id, debit for each customer along with their investment information.

[Assistant] SELECT *, investments.customer_id, investments.debit FROM finance.customers JOIN finance.investments ON customers.investment_id = investments.invoice_id;

[User] What is the average token for each first_name in customers?

[Assistant] SELECT first_name, AVERAGE(token) AS average_token FROM finance.customers GROUP BY first_name;


[User] Get all customers.

[Assistant] SELECT * FROM finance.customers;

[User] List investment_id, first_name, processed_at, balance for each customer along with their investment information.

[Assistant] SELECT *, investments.processed_at, investments.balance FROM finance.customers JOIN finance.investments ON customers.investment_id = investments.invoice_id;

[User] Show only 100 records.

[Assistant] SELECT *, investments.processed_at, investments.balance FROM finance.customers JOIN finance.investments ON customers.investment_id = investments.invoice_id LIMIT 100;


[User] Show me all customers.

[Assistant] SELECT * FROM finance.customers;

[User] List customers with dates created yesterday.

[Assistant] SELECT * FROM finance.customers WHERE birth_date = CURRENT_DATE - INTERVAL '1 day';

[User] Calculate min of birth_date for each token in customers.

[Assistant] SELECT token, MIN(birth_date) AS min_birth_date FROM finance.customers GROUP BY token;


[User] Get birth_date, joined_at, token from all customers.

[Assistant] SELECT birth_date, joined_at, token FROM finance.customers;

[User] Sort the results by is_active ascending.

[Assistant] SELECT birth_date, joined_at, token FROM finance.customers ORDER BY is_active ASC;

[User] Limit the results to 20 rows.

[Assistant] SELECT birth_date, joined_at, token FROM finance.customers ORDER BY is_active ASC LIMIT 20;


System:
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE tradingplatform.orders (
  id character varying(64) NOT NULL -- unique identifier,
  traded_at timestamp without time zone,
  cancelled_at date,
  currency character varying(64),
  status character varying(128),
  exchange_rate character varying(256),
  account_id text NOT NULL -- identifier for account,
  card_type character varying(64),
  log_id text -- reference to logs.content_id,
  FOREIGN KEY (log_id) REFERENCES logs(content_id)
)

CREATE TABLE tradingplatform.logs (
  content_id text PRIMARY KEY -- unique identifier,
  updated_at timestamp,
  created_at timestamp without time zone,
  keywords char,
  author_id character varying(64) NOT NULL,
  subject text
)

[User] Get all orders.

[Assistant] SELECT * FROM tradingplatform.orders;

[User] Get orders that match status LIKE 'A%'.

[Assistant] SELECT * FROM tradingplatform.orders WHERE status LIKE 'A%';

[User] Show the results sorted by card_type descending.

[Assistant] SELECT * FROM tradingplatform.orders WHERE status LIKE 'A%' ORDER BY card_type DESC;


[User] Get status, account_id, currency from all orders.

[Assistant] SELECT status, account_id, currency FROM tradingplatform.orders;

[User] Can you order these by status ascending?

[Assistant] SELECT status, account_id, currency FROM tradingplatform.orders ORDER BY status ASC;

[User] Count the number of orders in each account_id category.

[Assistant] SELECT account_id, COUNT(*) AS count FROM tradingplatform.orders GROUP BY account_id ORDER BY count DESC;


[User] Show me all orders.

[Assistant] SELECT * FROM tradingplatform.orders;

[User] Get exchange_rate, traded_at, subject, created_at by joining orders with logs.

[Assistant] SELECT *, logs.subject, logs.created_at FROM tradingplatform.orders JOIN tradingplatform.logs ON orders.log_id = logs.content_id;

[User] Get count of id by log_id from orders.

[Assistant] SELECT log_id, COUNT(id) AS count_id FROM tradingplatform.orders GROUP BY log_id;


[User] Display all orders.

[Assistant] SELECT * FROM tradingplatform.orders;

[User] Retrieve orders where the date is from 2023.

[Assistant] SELECT * FROM tradingplatform.orders WHERE cancelled_at BETWEEN '2023-01-01' AND '2023-12-31';

[User] Get the distribution of orders across different currency values.

[Assistant] SELECT currency, COUNT(*) AS count FROM tradingplatform.orders GROUP BY currency ORDER BY count DESC;


[User] Retrieve all orders.

[Assistant] SELECT * FROM tradingplatform.orders;

[User] What card_type, exchange_rate, subject, keywords do we have for orders and their associated logs?

[Assistant] SELECT *, logs.subject, logs.keywords FROM tradingplatform.orders JOIN tradingplatform.logs ON orders.log_id = logs.content_id;

[User] What is the average card_type for each account_id in orders?

[Assistant] SELECT account_id, AVERAGE(card_type) AS average_card_type FROM tradingplatform.orders GROUP BY account_id;


[User] List log_id, id, status from orders.

[Assistant] SELECT log_id, id, status FROM tradingplatform.orders;

[User] Find orders where account_id LIKE 'A%'.

[Assistant] SELECT log_id, id, status FROM tradingplatform.orders WHERE account_id LIKE 'A%';

[User] Get the distribution of orders across different id values.

[Assistant] SELECT id, COUNT(*) AS count FROM tradingplatform.orders GROUP BY id ORDER BY count DESC;


[User] List id, traded_at, exchange_rate from orders.

[Assistant] SELECT id, traded_at, exchange_rate FROM tradingplatform.orders;

[User] Get all orders created after December 1st, 2023.

[Assistant] SELECT id, traded_at, exchange_rate FROM tradingplatform.orders WHERE cancelled_at > '2023-12-01';

[User] Order the output by card_type ascending.

[Assistant] SELECT id, traded_at, exchange_rate FROM tradingplatform.orders WHERE cancelled_at > '2023-12-01' ORDER BY card_type ASC;


[User] Display all orders.

[Assistant] SELECT * FROM tradingplatform.orders;

[User] Find orders older than 6 months.

[Assistant] SELECT * FROM tradingplatform.orders WHERE cancelled_at <= CURRENT_DATE - INTERVAL '6 months';

[User] Tally up orders by account_id.

[Assistant] SELECT account_id, COUNT(*) AS count FROM tradingplatform.orders GROUP BY account_id ORDER BY count DESC;


[User] List all orders.

[Assistant] SELECT * FROM tradingplatform.orders;

[User] Retrieve log_id, id, subject, created_at showing the relationship between orders and logs.

[Assistant] SELECT *, logs.subject, logs.created_at FROM tradingplatform.orders JOIN tradingplatform.logs ON orders.log_id = logs.content_id;

[User] Sort the results by account_id descending.

[Assistant] SELECT *, logs.subject, logs.created_at FROM tradingplatform.orders JOIN tradingplatform.logs ON orders.log_id = logs.content_id ORDER BY account_id DESC;


[User] List cancelled_at, account_id, log_id from orders.

[Assistant] SELECT cancelled_at, account_id, log_id FROM tradingplatform.orders;

[User] Order the output by account_id ascending.

[Assistant] SELECT cancelled_at, account_id, log_id FROM tradingplatform.orders ORDER BY account_id ASC;

[User] Count the number of orders in each exchange_rate category.

[Assistant] SELECT exchange_rate, COUNT(*) AS count FROM tradingplatform.orders GROUP BY exchange_rate ORDER BY count DESC;


System:
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE tradingplatform.orders (
  payment_id text PRIMARY KEY -- unique identifier,
  processed_at timestamp,
  discount integer,
  amount numeric,
  subtotal numeric,
  customer_id character varying(128) NOT NULL,
  exchange_rate text,
  seller_id character varying(128) -- identifier for seller,
  user_id character varying(64) -- identifier for user,
  trade_id text -- reference to trades.transaction_id,
  FOREIGN KEY (trade_id) REFERENCES trades(transaction_id)
)

CREATE TABLE tradingplatform.trades (
  transaction_id text PRIMARY KEY -- unique identifier,
  created_at timestamp without time zone,
  exchange_rate varchar,
  buyer_id character varying(256) -- identifier for buyer,
  price numeric,
  user_id text NOT NULL -- reference to users.person_id,
  order_id text -- reference to orders.payment_id,
  FOREIGN KEY (user_id) REFERENCES users(person_id),
  FOREIGN KEY (order_id) REFERENCES orders(payment_id)
)

CREATE TABLE tradingplatform.users (
  person_id varchar PRIMARY KEY -- unique identifier,
  joined_at timestamp without time zone,
  full_name character varying(256),
  membership_level character varying(128),
  country character varying(128),
  is_active bit -- indicates if active is true,
  last_name character varying(256),
  trade_id text -- reference to trades.transaction_id,
  FOREIGN KEY (trade_id) REFERENCES trades(transaction_id)
)

[User] List all trades.

[Assistant] SELECT * FROM tradingplatform.trades;

[User] Retrieve trades where the date is created yesterday.

[Assistant] SELECT * FROM tradingplatform.trades WHERE created_at = CURRENT_DATE - INTERVAL '1 day';

[User] Limit the results to 20 rows.

[Assistant] SELECT * FROM tradingplatform.trades WHERE created_at = CURRENT_DATE - INTERVAL '1 day' LIMIT 20;


[User] List all users.

[Assistant] SELECT * FROM tradingplatform.users;

[User] Get country, full_name, order_id, price by joining users with trades.

[Assistant] SELECT *, trades.order_id, trades.price FROM tradingplatform.users JOIN tradingplatform.trades ON users.trade_id = trades.transaction_id;

[User] Count the number of users in each country category.

[Assistant] SELECT country, COUNT(*) AS count FROM tradingplatform.users GROUP BY country ORDER BY count DESC;


[User] Show me all users.

[Assistant] SELECT * FROM tradingplatform.users;

[User] Show me full_name, trade_id, buyer_id, price from users and their related trades.

[Assistant] SELECT *, trades.buyer_id, trades.price FROM tradingplatform.users JOIN tradingplatform.trades ON users.trade_id = trades.transaction_id;

[User] Show me the count of users grouped by full_name.

[Assistant] SELECT full_name, COUNT(*) AS count FROM tradingplatform.users GROUP BY full_name ORDER BY count DESC;


[User] List user_id, order_id, exchange_rate from trades.

[Assistant] SELECT user_id, order_id, exchange_rate FROM tradingplatform.trades;

[User] List trades that have exchange_rate LIKE 'A%'.

[Assistant] SELECT user_id, order_id, exchange_rate FROM tradingplatform.trades WHERE exchange_rate LIKE 'A%';

[User] Order the output by created_at ascending.

[Assistant] SELECT user_id, order_id, exchange_rate FROM tradingplatform.trades WHERE exchange_rate LIKE 'A%' ORDER BY created_at ASC;


[User] Get all users.

[Assistant] SELECT * FROM tradingplatform.users;

[User] Can you order these by country descending?

[Assistant] SELECT * FROM tradingplatform.users ORDER BY country DESC;

[User] Tally up users by full_name.

[Assistant] SELECT full_name, COUNT(*) AS count FROM tradingplatform.users GROUP BY full_name ORDER BY count DESC;


[User] Retrieve last_name, country, membership_level for every user.

[Assistant] SELECT last_name, country, membership_level FROM tradingplatform.users;

[User] List users that have trade_id LIKE 'A%'.

[Assistant] SELECT last_name, country, membership_level FROM tradingplatform.users WHERE trade_id LIKE 'A%';

[User] What is the count is_active for each last_name in users?

[Assistant] SELECT last_name, COUNT(is_active) AS count_is_active FROM tradingplatform.users GROUP BY last_name;


[User] Get all users.

[Assistant] SELECT * FROM tradingplatform.users;

[User] Get trade_id, joined_at, user_id, buyer_id by joining users with trades.

[Assistant] SELECT *, trades.user_id, trades.buyer_id FROM tradingplatform.users JOIN tradingplatform.trades ON users.trade_id = trades.transaction_id;

[User] Count the number of users in each membership_level category.

[Assistant] SELECT membership_level, COUNT(*) AS count FROM tradingplatform.users GROUP BY membership_level ORDER BY count DESC;


System:
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE e-commerce.products (
  sku integer PRIMARY KEY -- unique identifier,
  created_at timestamp without time zone,
  expires_at timestamp,
  views text NOT NULL,
  manufacturer character varying(64),
  name character varying(256),
  discount numeric,
  backorder text NOT NULL,
  cost bigint,
  shippin_id text -- reference to shipping.id,
  FOREIGN KEY (shippin_id) REFERENCES shipping(id)
)

CREATE TABLE e-commerce.shipping (
  id varchar PRIMARY KEY -- unique identifier,
  created_at date,
  last_active date,
  age text,
  country character varying(64),
  birth_date timestamp without time zone,
  nationality character varying(64)
)

[User] Show me all products.

[Assistant] SELECT * FROM e-commerce.products;

[User] Retrieve products where the date is from 2023.

[Assistant] SELECT * FROM e-commerce.products WHERE expires_at BETWEEN '2023-01-01' AND '2023-12-31';

[User] Only show the top 50 results.

[Assistant] SELECT * FROM e-commerce.products WHERE expires_at BETWEEN '2023-01-01' AND '2023-12-31' LIMIT 50;


[User] What are the name, discount, cost of each product?

[Assistant] SELECT name, discount, cost FROM e-commerce.products;

[User] What views, discount, country, birth_date do we have for products and their associated shipping?

[Assistant] SELECT name, discount, cost, shipping.country, shipping.birth_date FROM e-commerce.products JOIN e-commerce.shipping ON products.shippin_id = shipping.id;

[User] Limit the results to 15 rows.

[Assistant] SELECT name, discount, cost, shipping.country, shipping.birth_date FROM e-commerce.products JOIN e-commerce.shipping ON products.shippin_id = shipping.id LIMIT 15;