[User] Display all purchases.

[Assistant] SELECT * FROM travel.purchases;

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

[Assistant] SELECT * FROM travel.purchases WHERE created_at >= CURRENT_DATE - INTERVAL '30 days';

[User] Show me sum of payment_method grouped by created_at for purchases.

[Assistant] SELECT created_at, SUM(payment_method) AS sum_payment_method FROM travel.purchases GROUP BY created_at;


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 travel.purchases (
  id character varying(64) NOT NULL -- unique identifier,
  created_at timestamp without time zone,
  cancelled_at timestamp without time zone,
  card_type char,
  product_id text,
  approval_status character varying(256) NOT NULL,
  total smallint,
  user_id varchar NOT NULL -- identifier for user,
  payment_method varchar NOT NULL,
  facilitie_id text NOT NULL -- reference to facilities.address_id,
  FOREIGN KEY (facilitie_id) REFERENCES facilities(address_id)
)

CREATE TABLE travel.facilities (
  address_id varchar PRIMARY KEY -- unique identifier,
  updated_at timestamp without time zone,
  description character varying(64),
  accessibility character varying(128),
  zip_code character varying(64) NOT NULL,
  type character varying(256),
  postal_code character varying(64) NOT NULL,
  member_id text NOT NULL -- reference to members.id,
  FOREIGN KEY (member_id) REFERENCES members(id)
)

CREATE TABLE travel.members (
  id varchar PRIMARY KEY -- unique identifier,
  updated_at timestamp without time zone,
  joined_at date,
  last_name varchar NOT NULL,
  first_name character varying(64),
  full_name character varying(128),
  state text,
  is_active boolean NOT NULL -- indicates if active is true,
  display_name char
)

[User] Get postal_code, accessibility, member_id from all facilities.

[Assistant] SELECT postal_code, accessibility, member_id FROM travel.facilities;

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

[Assistant] SELECT postal_code, accessibility, member_id FROM travel.facilities WHERE updated_at >= CURRENT_TIMESTAMP - INTERVAL '1 hour';

[User] Can you order these by postal_code descending?

[Assistant] SELECT postal_code, accessibility, member_id FROM travel.facilities WHERE updated_at >= CURRENT_TIMESTAMP - INTERVAL '1 hour' ORDER BY postal_code DESC;


[User] Show me description, type, updated_at for all facilities.

[Assistant] SELECT description, type, updated_at FROM travel.facilities;

[User] Show the results sorted by member_id ascending.

[Assistant] SELECT description, type, updated_at FROM travel.facilities ORDER BY member_id ASC;

[User] Show the results sorted by zip_code ascending.

[Assistant] SELECT description, type, updated_at FROM travel.facilities ORDER BY zip_code ASC;


[User] Show me all purchases.

[Assistant] SELECT * FROM travel.purchases;

[User] List approval_status, id, postal_code, description for each purchase along with their facilitie information.

[Assistant] SELECT *, facilities.postal_code, facilities.description FROM travel.purchases JOIN travel.facilities ON purchases.facilitie_id = facilities.address_id;

[User] What is the sum product_id for each facilitie_id in purchases?

[Assistant] SELECT facilitie_id, SUM(product_id) AS sum_product_id FROM travel.purchases GROUP BY facilitie_id;


[User] Show me all purchases.

[Assistant] SELECT * FROM travel.purchases;

[User] Show me approval_status, facilitie_id, zip_code, updated_at from purchases and their related facilities.

[Assistant] SELECT *, facilities.zip_code, facilities.updated_at FROM travel.purchases JOIN travel.facilities ON purchases.facilitie_id = facilities.address_id;

[User] Get min of approval_status by created_at from purchases.

[Assistant] SELECT created_at, MIN(approval_status) AS min_approval_status FROM travel.purchases GROUP BY created_at;


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 travel.students (
  employee_id integer PRIMARY KEY -- unique identifier,
  last_active timestamp without time zone,
  country varchar,
  username character varying(64),
  display_name text,
  is_verified boolean -- indicates if verified is true,
  last_name character varying(128),
  purchase_id text -- reference to purchases.payment_id,
  FOREIGN KEY (purchase_id) REFERENCES purchases(payment_id)
)

CREATE TABLE travel.purchases (
  payment_id varchar PRIMARY KEY -- unique identifier,
  processed_at date,
  updated_at timestamp,
  card_type character varying(128),
  payment_status character varying(64),
  discount numeric(38,14),
  approval_status varchar,
  student_id integer NOT NULL -- reference to students.employee_id,
  FOREIGN KEY (student_id) REFERENCES students(employee_id)
)

CREATE TABLE travel.venues (
  address_id varchar PRIMARY KEY -- unique identifier,
  updated_at timestamp,
  address_line1 character varying(64),
  state character varying(128),
  location_lat character varying(128),
  country char NOT NULL,
  purchase_id text -- reference to purchases.payment_id,
  FOREIGN KEY (purchase_id) REFERENCES purchases(payment_id)
)

[User] List all venues.

[Assistant] SELECT * FROM travel.venues;

[User] What updated_at, address_line1, updated_at, card_type do we have for venues and their associated purchases?

[Assistant] SELECT *, purchases.updated_at, purchases.card_type FROM travel.venues JOIN travel.purchases ON venues.purchase_id = purchases.payment_id;

[User] Only show the top 5 results.

[Assistant] SELECT *, purchases.updated_at, purchases.card_type FROM travel.venues JOIN travel.purchases ON venues.purchase_id = purchases.payment_id LIMIT 5;


[User] Get all students.

[Assistant] SELECT * FROM travel.students;

[User] Retrieve students where display_name LIKE 'A%'.

[Assistant] SELECT * FROM travel.students WHERE display_name LIKE 'A%';

[User] Show only 25 records.

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


[User] Show me all venues.

[Assistant] SELECT * FROM travel.venues;

[User] Find venues from 2023.

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

[User] How many venues are there per purchase_id?

[Assistant] SELECT purchase_id, COUNT(*) AS count FROM travel.venues GROUP BY purchase_id ORDER BY count DESC;


[User] Show me all students.

[Assistant] SELECT * FROM travel.students;

[User] List students that have last_active > '2023-01-01'.

[Assistant] SELECT * FROM travel.students WHERE last_active > '2023-01-01';

[User] Limit the results to 20 rows.

[Assistant] SELECT * FROM travel.students WHERE last_active > '2023-01-01' LIMIT 20;


[User] Get discount, approval_status, updated_at from all purchases.

[Assistant] SELECT discount, approval_status, updated_at FROM travel.purchases;

[User] Show me purchases with updated_at > '2023-01-01'.

[Assistant] SELECT discount, approval_status, updated_at FROM travel.purchases WHERE updated_at > '2023-01-01';

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

[Assistant] SELECT discount, approval_status, updated_at FROM travel.purchases WHERE updated_at > '2023-01-01' ORDER BY payment_status ASC;


[User] List all venues.

[Assistant] SELECT * FROM travel.venues;

[User] Order the output by updated_at ascending.

[Assistant] SELECT * FROM travel.venues ORDER BY updated_at ASC;

[User] Calculate max of updated_at for each location_lat in venues.

[Assistant] SELECT location_lat, MAX(updated_at) AS max_updated_at FROM travel.venues GROUP BY location_lat;


[User] Display all students.

[Assistant] SELECT * FROM travel.students;

[User] Can you order these by is_verified ascending?

[Assistant] SELECT * FROM travel.students ORDER BY is_verified ASC;

[User] Get the distribution of students across different last_active values.

[Assistant] SELECT last_active, COUNT(*) AS count FROM travel.students GROUP BY last_active ORDER BY count DESC;


[User] List student_id, payment_status, card_type from purchases.

[Assistant] SELECT student_id, payment_status, card_type FROM travel.purchases;

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

[Assistant] SELECT student_id, payment_status, card_type FROM travel.purchases ORDER BY approval_status ASC;

[User] Restrict the output to 15 items.

[Assistant] SELECT student_id, payment_status, card_type FROM travel.purchases ORDER BY approval_status ASC LIMIT 15;


[User] What are the approval_status, discount, processed_at of each purchase?

[Assistant] SELECT approval_status, discount, processed_at FROM travel.purchases;

[User] Show the results sorted by processed_at ascending.

[Assistant] SELECT approval_status, discount, processed_at FROM travel.purchases ORDER BY processed_at ASC;

[User] How many purchases are there per approval_status?

[Assistant] SELECT approval_status, COUNT(*) AS count FROM travel.purchases GROUP BY approval_status 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.reviews (
  post_id character varying(64) NOT NULL -- unique identifier,
  edited_at timestamp without time zone,
  updated_at timestamp,
  media_url char,
  format char,
  order_id text -- reference to orders.transaction_id,
  FOREIGN KEY (order_id) REFERENCES orders(transaction_id)
)

CREATE TABLE e-commerce.orders (
  transaction_id text PRIMARY KEY -- unique identifier,
  cancelled_at timestamp without time zone,
  processed_at timestamp,
  delivery_status char,
  account_id char,
  currency text NOT NULL,
  product_id character varying(128) -- identifier for product,
  buyer_id varchar
)

CREATE TABLE e-commerce.order_items (
  id varchar PRIMARY KEY -- unique identifier,
  published_at timestamp,
  title character varying(64),
  backorder character varying(256) NOT NULL,
  stock_level varchar,
  featured_rank character varying(256) NOT NULL,
  reserved char NOT NULL,
  price integer
)

[User] Show me order_id, edited_at, updated_at for all reviews.

[Assistant] SELECT order_id, edited_at, updated_at FROM e-commerce.reviews;

[User] Show the results sorted by updated_at descending.

[Assistant] SELECT order_id, edited_at, updated_at FROM e-commerce.reviews ORDER BY updated_at DESC;

[User] Calculate average of format for each media_url in reviews.

[Assistant] SELECT media_url, AVERAGE(format) AS average_format FROM e-commerce.reviews GROUP BY media_url;


[User] Show me format, updated_at, post_id for all reviews.

[Assistant] SELECT format, updated_at, post_id FROM e-commerce.reviews;

[User] List reviews that have order_id LIKE 'A%'.

[Assistant] SELECT format, updated_at, post_id FROM e-commerce.reviews WHERE order_id LIKE 'A%';

[User] Calculate sum of media_url for each post_id in reviews.

[Assistant] SELECT post_id, SUM(media_url) AS sum_media_url FROM e-commerce.reviews GROUP BY post_id;


[User] Show me post_id, updated_at, order_id for all reviews.

[Assistant] SELECT post_id, updated_at, order_id FROM e-commerce.reviews;

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

[Assistant] SELECT post_id, updated_at, order_id FROM e-commerce.reviews WHERE updated_at >= CURRENT_DATE - INTERVAL '30 days';

[User] Order the output by edited_at descending.

[Assistant] SELECT post_id, updated_at, order_id FROM e-commerce.reviews WHERE updated_at >= CURRENT_DATE - INTERVAL '30 days' ORDER BY edited_at DESC;


[User] List order_id, media_url, updated_at from reviews.

[Assistant] SELECT order_id, media_url, updated_at FROM e-commerce.reviews;

[User] What media_url, order_id, product_id, currency do we have for reviews and their associated orders?

[Assistant] SELECT order_id, media_url, updated_at, orders.product_id, orders.currency FROM e-commerce.reviews JOIN e-commerce.orders ON reviews.order_id = orders.transaction_id;

[User] Order the output by edited_at descending.

[Assistant] SELECT order_id, media_url, updated_at, orders.product_id, orders.currency FROM e-commerce.reviews JOIN e-commerce.orders ON reviews.order_id = orders.transaction_id ORDER BY edited_at DESC;


[User] Retrieve all reviews.

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

[User] Retrieve reviews where format LIKE 'A%'.

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

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

[Assistant] SELECT * FROM e-commerce.reviews WHERE format LIKE 'A%' ORDER BY post_id DESC;


[User] Show me all reviews.

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

[User] Show me reviews that were created yesterday.

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

[User] Show only 10 records.

[Assistant] SELECT * FROM e-commerce.reviews WHERE edited_at = CURRENT_DATE - INTERVAL '1 day' LIMIT 10;


[User] List post_id, order_id, updated_at from reviews.

[Assistant] SELECT post_id, order_id, updated_at FROM e-commerce.reviews;

[User] Get updated_at, order_id, cancelled_at, delivery_status by joining reviews with orders.

[Assistant] SELECT post_id, order_id, updated_at, orders.cancelled_at, orders.delivery_status FROM e-commerce.reviews JOIN e-commerce.orders ON reviews.order_id = orders.transaction_id;

[User] Group reviews by edited_at and show the sum of post_id.

[Assistant] SELECT edited_at, SUM(post_id) AS sum_post_id FROM e-commerce.reviews GROUP BY edited_at;


[User] Get all reviews.

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

[User] Sort the results by media_url ascending.

[Assistant] SELECT * FROM e-commerce.reviews ORDER BY media_url ASC;

[User] Return just 15 rows.

[Assistant] SELECT * FROM e-commerce.reviews ORDER BY media_url ASC LIMIT 15;


[User] Get media_url, format, post_id from all reviews.

[Assistant] SELECT media_url, format, post_id FROM e-commerce.reviews;

[User] List reviews that have order_id LIKE 'A%'.

[Assistant] SELECT media_url, format, post_id FROM e-commerce.reviews WHERE order_id LIKE 'A%';

[User] Tally up reviews by media_url.

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


[User] Retrieve all reviews.

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

[User] Retrieve reviews where order_id LIKE 'A%'.

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

[User] Calculate average of format for each updated_at in reviews.

[Assistant] SELECT updated_at, AVERAGE(format) AS average_format FROM e-commerce.reviews GROUP BY updated_at;


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.teachers (
  sku integer PRIMARY KEY -- unique identifier,
  expires_at timestamp without time zone,
  category character varying(256),
  quantity character varying(64),
  featured_rank character varying(64),
  available char,
  rating character varying(256),
  student_id text NOT NULL -- reference to students.user_id,
  grade_id integer -- reference to grades.id,
  FOREIGN KEY (student_id) REFERENCES students(user_id),
  FOREIGN KEY (grade_id) REFERENCES grades(id)
)

CREATE TABLE education.grades (
  id integer PRIMARY KEY -- unique identifier,
  updated_at timestamp,
  expires_at timestamp without time zone,
  views char,
  manufacturer char,
  price smallint,
  teacher_id integer NOT NULL -- reference to teachers.sku,
  FOREIGN KEY (teacher_id) REFERENCES teachers(sku)
)

CREATE TABLE education.students (
  user_id text PRIMARY KEY -- unique identifier,
  updated_at timestamp without time zone,
  joined_at date,
  membership_level text,
  display_name character varying(128),
  token char,
  teacher_id integer NOT NULL -- reference to teachers.sku,
  FOREIGN KEY (teacher_id) REFERENCES teachers(sku)
)

[User] What are the manufacturer, views, expires_at of each grade?

[Assistant] SELECT manufacturer, views, expires_at FROM education.grades;

[User] What teacher_id, updated_at, category, quantity do we have for grades and their associated teachers?

[Assistant] SELECT manufacturer, views, expires_at, teachers.category, teachers.quantity FROM education.grades JOIN education.teachers ON grades.teacher_id = teachers.sku;

[User] Show only 20 records.

[Assistant] SELECT manufacturer, views, expires_at, teachers.category, teachers.quantity FROM education.grades JOIN education.teachers ON grades.teacher_id = teachers.sku LIMIT 20;


[User] Show me display_name, updated_at, teacher_id for all students.

[Assistant] SELECT display_name, updated_at, teacher_id FROM education.students;

[User] Get students that match display_name LIKE 'A%'.

[Assistant] SELECT display_name, updated_at, teacher_id FROM education.students WHERE display_name LIKE 'A%';

[User] Show me min of token grouped by updated_at for students.

[Assistant] SELECT updated_at, MIN(token) AS min_token FROM education.students GROUP BY updated_at;


[User] What are the expires_at, available, featured_rank of each teacher?

[Assistant] SELECT expires_at, available, featured_rank FROM education.teachers;

[User] List rating, quantity, updated_at, membership_level for each teacher along with their student information.

[Assistant] SELECT expires_at, available, featured_rank, students.updated_at, students.membership_level FROM education.teachers JOIN education.students ON teachers.student_id = students.user_id;

[User] Sort the results by expires_at descending.

[Assistant] SELECT expires_at, available, featured_rank, students.updated_at, students.membership_level FROM education.teachers JOIN education.students ON teachers.student_id = students.user_id ORDER BY expires_at DESC;


[User] Display all teachers.

[Assistant] SELECT * FROM education.teachers;

[User] Can you order these by available descending?

[Assistant] SELECT * FROM education.teachers ORDER BY available DESC;

[User] How many teachers are there per quantity?

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


[User] Get all students.

[Assistant] SELECT * FROM education.students;

[User] Sort the results by updated_at descending.

[Assistant] SELECT * FROM education.students ORDER BY updated_at DESC;

[User] Limit the results to 20 rows.

[Assistant] SELECT * FROM education.students ORDER BY updated_at DESC LIMIT 20;


[User] What are the expires_at, price, manufacturer of each grade?

[Assistant] SELECT expires_at, price, manufacturer FROM education.grades;

[User] What manufacturer, updated_at, grade_id, rating do we have for grades and their associated teachers?

[Assistant] SELECT expires_at, price, manufacturer, teachers.grade_id, teachers.rating FROM education.grades JOIN education.teachers ON grades.teacher_id = teachers.sku;

[User] What is the min expires_at for each updated_at in grades?

[Assistant] SELECT updated_at, MIN(expires_at) AS min_expires_at FROM education.grades GROUP BY updated_at;


[User] List rating, grade_id, category from teachers.

[Assistant] SELECT rating, grade_id, category FROM education.teachers;

[User] Get all teachers from 2023.

[Assistant] SELECT rating, grade_id, category FROM education.teachers WHERE expires_at BETWEEN '2023-01-01' AND '2023-12-31';

[User] How many teachers are there per expires_at?

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


[User] List all grades.

[Assistant] SELECT * FROM education.grades;

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

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

[User] Count the number of grades in each views category.

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


[User] Get all teachers.

[Assistant] SELECT * FROM education.teachers;

[User] Show the results sorted by available ascending.

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

[User] Get the distribution of teachers across different expires_at values.

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


[User] List all grades.

[Assistant] SELECT * FROM education.grades;

[User] Find grades where price > 36.

[Assistant] SELECT * FROM education.grades WHERE price > 36;

[User] Sort the results by expires_at ascending.

[Assistant] SELECT * FROM education.grades WHERE price > 36 ORDER BY expires_at 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 socialmedia.messages (
  content_id character varying(64) NOT NULL -- unique identifier,
  published_at timestamp,
  media_url character varying(128),
  user_id char,
  rating char,
  description character varying(128),
  follower_id integer NOT NULL -- reference to followers.invoice_id,
  FOREIGN KEY (follower_id) REFERENCES followers(invoice_id)
)

CREATE TABLE socialmedia.followers (
  invoice_id integer PRIMARY KEY -- unique identifier,
  due_date timestamp without time zone,
  processed_at date,
  payer_id character varying(256) -- identifier for payer,
  description char NOT NULL,
  user_id text -- identifier for user,
  category character varying(128) NOT NULL,
  balance smallint NOT NULL
)

[User] Display all messages.

[Assistant] SELECT * FROM socialmedia.messages;

[User] Show me messages with user_id LIKE 'A%'.

[Assistant] SELECT * FROM socialmedia.messages WHERE user_id LIKE 'A%';

[User] Group messages by rating and show the average of rating.

[Assistant] SELECT rating, AVERAGE(rating) AS average_rating FROM socialmedia.messages GROUP BY rating;


[User] List all messages.

[Assistant] SELECT * FROM socialmedia.messages;

[User] List messages with dates from 2023.

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

[User] Tally up messages by media_url.

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


[User] Retrieve all messages.

[Assistant] SELECT * FROM socialmedia.messages;

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

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

[User] Calculate min of content_id for each user_id in messages.

[Assistant] SELECT user_id, MIN(content_id) AS min_content_id FROM socialmedia.messages GROUP BY user_id;


[User] List all messages.

[Assistant] SELECT * FROM socialmedia.messages;

[User] Retrieve messages where the date is older than 6 months.

[Assistant] SELECT * FROM socialmedia.messages WHERE published_at <= CURRENT_DATE - INTERVAL '6 months';

[User] Show the results sorted by rating descending.

[Assistant] SELECT * FROM socialmedia.messages WHERE published_at <= CURRENT_DATE - INTERVAL '6 months' ORDER BY rating DESC;


[User] Get all messages.

[Assistant] SELECT * FROM socialmedia.messages;

[User] List messages with dates from last week.

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

[User] How many messages are there per rating?

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


[User] Show me published_at, rating, user_id for all messages.

[Assistant] SELECT published_at, rating, user_id FROM socialmedia.messages;

[User] Show the results sorted by published_at ascending.

[Assistant] SELECT published_at, rating, user_id FROM socialmedia.messages ORDER BY published_at ASC;

[User] Calculate average of description for each follower_id in messages.

[Assistant] SELECT follower_id, AVERAGE(description) AS average_description FROM socialmedia.messages GROUP BY follower_id;


[User] List published_at, description, user_id from messages.

[Assistant] SELECT published_at, description, user_id FROM socialmedia.messages;

[User] Sort the results by rating ascending.

[Assistant] SELECT published_at, description, user_id FROM socialmedia.messages ORDER BY rating ASC;

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

[Assistant] SELECT published_at, description, user_id FROM socialmedia.messages ORDER BY content_id DESC;


[User] Get description, user_id, published_at from all messages.

[Assistant] SELECT description, user_id, published_at FROM socialmedia.messages;

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

[Assistant] SELECT description, user_id, published_at FROM socialmedia.messages WHERE published_at >= CURRENT_TIMESTAMP - INTERVAL '1 hour';

[User] Calculate min of user_id for each follower_id in messages.

[Assistant] SELECT follower_id, MIN(user_id) AS min_user_id FROM socialmedia.messages GROUP BY follower_id;


[User] Get rating, user_id, description from all messages.

[Assistant] SELECT rating, user_id, description FROM socialmedia.messages;

[User] Retrieve description, user_id, description, payer_id showing the relationship between messages and followers.

[Assistant] SELECT rating, user_id, description, followers.description, followers.payer_id FROM socialmedia.messages JOIN socialmedia.followers ON messages.follower_id = followers.invoice_id;

[User] Group messages by media_url and show the average of published_at.

[Assistant] SELECT media_url, AVERAGE(published_at) AS average_published_at FROM socialmedia.messages GROUP BY media_url;


[User] Retrieve description, user_id, content_id for every message.

[Assistant] SELECT description, user_id, content_id FROM socialmedia.messages;

[User] What description, content_id, user_id, description do we have for messages and their associated followers?

[Assistant] SELECT description, user_id, content_id, followers.user_id, followers.description FROM socialmedia.messages JOIN socialmedia.followers ON messages.follower_id = followers.invoice_id;

[User] Get the distribution of messages across different follower_id values.

[Assistant] SELECT follower_id, COUNT(*) AS count FROM socialmedia.messages GROUP BY follower_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 tradingplatform.metadata (
  sku text PRIMARY KEY -- unique identifier,
  expires_at timestamp without time zone,
  created_at date,
  rating varchar NOT NULL,
  video_url character varying(64) -- identifier for video_url,
  backorder char,
  views text,
  tax_rate character varying(128),
  asset_id text -- reference to assets.item_id,
  FOREIGN KEY (asset_id) REFERENCES assets(item_id)
)

CREATE TABLE tradingplatform.assets (
  item_id varchar PRIMARY KEY -- unique identifier,
  expires_at timestamp without time zone,
  published_at timestamp,
  category char,
  manufacturer character varying(64),
  image_url char NOT NULL,
  metadat_id text NOT NULL -- reference to metadata.sku,
  FOREIGN KEY (metadat_id) REFERENCES metadata(sku)
)

[User] List expires_at, views, asset_id from metadata.

[Assistant] SELECT expires_at, views, asset_id FROM tradingplatform.metadata;

[User] Sort the results by asset_id ascending.

[Assistant] SELECT expires_at, views, asset_id FROM tradingplatform.metadata ORDER BY asset_id ASC;

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

[Assistant] SELECT expires_at, views, asset_id FROM tradingplatform.metadata ORDER BY created_at ASC;


[User] List manufacturer, metadat_id, published_at from assets.

[Assistant] SELECT manufacturer, metadat_id, published_at FROM tradingplatform.assets;

[User] Show me assets with published_at > '2023-01-01'.

[Assistant] SELECT manufacturer, metadat_id, published_at FROM tradingplatform.assets WHERE published_at > '2023-01-01';

[User] Count the number of assets in each metadat_id category.

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


[User] List all assets.

[Assistant] SELECT * FROM tradingplatform.assets;

[User] Retrieve assets where expires_at > '2023-01-01'.

[Assistant] SELECT * FROM tradingplatform.assets WHERE expires_at > '2023-01-01';

[User] Calculate sum of image_url for each category in assets.

[Assistant] SELECT category, SUM(image_url) AS sum_image_url FROM tradingplatform.assets GROUP BY category;


[User] Show me all assets.

[Assistant] SELECT * FROM tradingplatform.assets;

[User] Retrieve published_at, category, rating, backorder showing the relationship between assets and metadata.

[Assistant] SELECT *, metadata.rating, metadata.backorder FROM tradingplatform.assets JOIN tradingplatform.metadata ON assets.metadat_id = metadata.sku;

[User] How many assets are there per expires_at?

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


[User] Retrieve tax_rate, created_at, rating for every metadata.

[Assistant] SELECT tax_rate, created_at, rating FROM tradingplatform.metadata;

[User] Find metadata modified within the last hour.

[Assistant] SELECT tax_rate, created_at, rating FROM tradingplatform.metadata WHERE created_at >= CURRENT_TIMESTAMP - INTERVAL '1 hour';

[User] What is the average tax_rate for each tax_rate in metadata?

[Assistant] SELECT tax_rate, AVERAGE(tax_rate) AS average_tax_rate FROM tradingplatform.metadata GROUP BY tax_rate;


[User] Display all assets.

[Assistant] SELECT * FROM tradingplatform.assets;

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

[Assistant] SELECT * FROM tradingplatform.assets WHERE published_at BETWEEN '2023-01-01' AND '2023-03-31';

[User] Count the number of assets in each expires_at category.

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


[User] Display all assets.

[Assistant] SELECT * FROM tradingplatform.assets;

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

[Assistant] SELECT * FROM tradingplatform.assets WHERE expires_at >= CURRENT_TIMESTAMP - INTERVAL '1 hour';

[User] How many assets are there per published_at?

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


[User] What are the tax_rate, views, backorder of each metadata?

[Assistant] SELECT tax_rate, views, backorder FROM tradingplatform.metadata;

[User] List rating, video_url, expires_at, metadat_id for each metadata along with their asset information.

[Assistant] SELECT tax_rate, views, backorder, assets.expires_at, assets.metadat_id FROM tradingplatform.metadata JOIN tradingplatform.assets ON metadata.asset_id = assets.item_id;

[User] Show me min of created_at grouped by tax_rate for metadata.

[Assistant] SELECT tax_rate, MIN(created_at) AS min_created_at FROM tradingplatform.metadata GROUP BY tax_rate;


[User] Show me all metadata.

[Assistant] SELECT * FROM tradingplatform.metadata;

[User] List tax_rate, video_url, expires_at, manufacturer for each metadata along with their asset information.

[Assistant] SELECT *, assets.expires_at, assets.manufacturer FROM tradingplatform.metadata JOIN tradingplatform.assets ON metadata.asset_id = assets.item_id;

[User] Show me count of views grouped by rating for metadata.

[Assistant] SELECT rating, COUNT(views) AS count_views FROM tradingplatform.metadata GROUP BY rating;


[User] Retrieve image_url, manufacturer, published_at for every asset.

[Assistant] SELECT image_url, manufacturer, published_at FROM tradingplatform.assets;

[User] Order the output by manufacturer ascending.

[Assistant] SELECT image_url, manufacturer, published_at FROM tradingplatform.assets ORDER BY manufacturer ASC;

[User] Calculate average of manufacturer for each category in assets.

[Assistant] SELECT category, AVERAGE(manufacturer) AS average_manufacturer FROM tradingplatform.assets GROUP BY category;


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.wallets (
  account_id integer PRIMARY KEY -- unique identifier,
  created_at timestamp without time zone,
  verification_status varchar,
  vendor_id char NOT NULL -- identifier for vendor,
  status character varying(128),
  debit character varying(128) NOT NULL,
  notification_id text -- reference to notifications.id,
  FOREIGN KEY (notification_id) REFERENCES notifications(id)
)

CREATE TABLE tradingplatform.metadata (
  person_id integer PRIMARY KEY -- unique identifier,
  updated_at timestamp without time zone,
  last_active timestamp,
  is_active bit,
  display_name varchar,
  bio varchar NOT NULL,
  first_name character varying(64),
  language character varying(64) NOT NULL,
  notification_id text -- reference to notifications.id,
  FOREIGN KEY (notification_id) REFERENCES notifications(id)
)

CREATE TABLE tradingplatform.notifications (
  id varchar PRIMARY KEY -- unique identifier,
  created_at timestamp without time zone,
  published_at date,
  attachment_url text NOT NULL,
  keywords character varying(256),
  reply_to_id char -- identifier for reply_to,
  views varchar NOT NULL,
  metadat_id integer NOT NULL -- reference to metadata.person_id,
  wallet_id integer -- reference to wallets.account_id,
  FOREIGN KEY (metadat_id) REFERENCES metadata(person_id),
  FOREIGN KEY (wallet_id) REFERENCES wallets(account_id)
)

[User] Get all wallets.

[Assistant] SELECT * FROM tradingplatform.wallets;

[User] Show me wallets with debit LIKE 'A%'.

[Assistant] SELECT * FROM tradingplatform.wallets WHERE debit LIKE 'A%';

[User] Show me average of debit grouped by notification_id for wallets.

[Assistant] SELECT notification_id, AVERAGE(debit) AS average_debit FROM tradingplatform.wallets GROUP BY notification_id;


[User] Retrieve all notifications.

[Assistant] SELECT * FROM tradingplatform.notifications;

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

[Assistant] SELECT * FROM tradingplatform.notifications WHERE published_at >= CURRENT_DATE - INTERVAL '30 days';

[User] Only show the top 5 results.

[Assistant] SELECT * FROM tradingplatform.notifications WHERE published_at >= CURRENT_DATE - INTERVAL '30 days' LIMIT 5;


[User] Retrieve all metadata.

[Assistant] SELECT * FROM tradingplatform.metadata;

[User] Can you order these by bio ascending?

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

[User] Can you order these by language descending?

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


[User] Get is_active, last_active, bio from all metadata.

[Assistant] SELECT is_active, last_active, bio FROM tradingplatform.metadata;

[User] Can you order these by language descending?

[Assistant] SELECT is_active, last_active, bio FROM tradingplatform.metadata ORDER BY language DESC;

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

[Assistant] SELECT is_active, last_active, bio FROM tradingplatform.metadata ORDER BY notification_id ASC;


[User] Get all metadata.

[Assistant] SELECT * FROM tradingplatform.metadata;

[User] Sort the results by display_name descending.

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

[User] Tally up metadata by display_name.

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


[User] List bio, last_active, updated_at from metadata.

[Assistant] SELECT bio, last_active, updated_at FROM tradingplatform.metadata;

[User] Show me metadata with is_active = TRUE.

[Assistant] SELECT bio, last_active, updated_at FROM tradingplatform.metadata WHERE is_active = TRUE;

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

[Assistant] SELECT bio, last_active, updated_at FROM tradingplatform.metadata WHERE is_active = TRUE ORDER BY language DESC;


[User] Get all wallets.

[Assistant] SELECT * FROM tradingplatform.wallets;

[User] Sort the results by created_at descending.

[Assistant] SELECT * FROM tradingplatform.wallets ORDER BY created_at DESC;

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

[Assistant] SELECT * FROM tradingplatform.wallets ORDER BY verification_status 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 socialmedia.messages (
  id character varying(64) NOT NULL -- unique identifier,
  edited_at date,
  message varchar NOT NULL,
  parent_id character varying(64),
  title character varying(128) NOT NULL,
  views character varying(128),
  author_id text NOT NULL -- identifier for author,
  keywords character varying(128),
  user_id text -- reference to users.user_id,
  FOREIGN KEY (user_id) REFERENCES users(user_id)
)

CREATE TABLE socialmedia.groups (
  barcode character varying(64) NOT NULL -- unique identifier,
  updated_at timestamp,
  video_url character varying(64),
  msrp character varying(256),
  rating character varying(256),
  reserved char,
  manufacturer character varying(64),
  available character varying(128) NOT NULL,
  user_id text NOT NULL -- reference to users.user_id,
  FOREIGN KEY (user_id) REFERENCES users(user_id)
)

CREATE TABLE socialmedia.users (
  user_id text PRIMARY KEY -- unique identifier,
  created_at date,
  last_active timestamp without time zone,
  timezone character varying(64) NOT NULL,
  display_name char,
  membership_level character varying(256),
  zip_code varchar,
  account_status varchar,
  last_name char,
  language char
)

[User] Retrieve all groups.

[Assistant] SELECT * FROM socialmedia.groups;

[User] Get barcode, rating, display_name, membership_level by joining groups with users.

[Assistant] SELECT *, users.display_name, users.membership_level FROM socialmedia.groups JOIN socialmedia.users ON groups.user_id = users.user_id;

[User] Show only 100 records.

[Assistant] SELECT *, users.display_name, users.membership_level FROM socialmedia.groups JOIN socialmedia.users ON groups.user_id = users.user_id LIMIT 100;


[User] Get rating, reserved, updated_at from all groups.

[Assistant] SELECT rating, reserved, updated_at FROM socialmedia.groups;

[User] Get available, video_url, membership_level, last_name by joining groups with users.

[Assistant] SELECT rating, reserved, updated_at, users.membership_level, users.last_name FROM socialmedia.groups JOIN socialmedia.users ON groups.user_id = users.user_id;

[User] Order the output by rating descending.

[Assistant] SELECT rating, reserved, updated_at, users.membership_level, users.last_name FROM socialmedia.groups JOIN socialmedia.users ON groups.user_id = users.user_id ORDER BY rating DESC;


[User] Retrieve reserved, msrp, barcode for every group.

[Assistant] SELECT reserved, msrp, barcode FROM socialmedia.groups;

[User] Retrieve available, reserved, account_status, last_active showing the relationship between groups and users.

[Assistant] SELECT reserved, msrp, barcode, users.account_status, users.last_active FROM socialmedia.groups JOIN socialmedia.users ON groups.user_id = users.user_id;

[User] Return just 25 rows.

[Assistant] SELECT reserved, msrp, barcode, users.account_status, users.last_active FROM socialmedia.groups JOIN socialmedia.users ON groups.user_id = users.user_id LIMIT 25;


[User] Retrieve id, title, keywords for every message.

[Assistant] SELECT id, title, keywords FROM socialmedia.messages;

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

[Assistant] SELECT id, title, keywords FROM socialmedia.messages WHERE edited_at > '2023-12-01';

[User] Show only 5 records.

[Assistant] SELECT id, title, keywords FROM socialmedia.messages WHERE edited_at > '2023-12-01' LIMIT 5;


[User] List all messages.

[Assistant] SELECT * FROM socialmedia.messages;

[User] Get author_id, edited_at, zip_code, display_name by joining messages with users.

[Assistant] SELECT *, users.zip_code, users.display_name FROM socialmedia.messages JOIN socialmedia.users ON messages.user_id = users.user_id;

[User] Get min of message by keywords from messages.

[Assistant] SELECT keywords, MIN(message) AS min_message FROM socialmedia.messages GROUP BY keywords;


[User] What are the reserved, available, manufacturer of each group?

[Assistant] SELECT reserved, available, manufacturer FROM socialmedia.groups;

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

[Assistant] SELECT reserved, available, manufacturer FROM socialmedia.groups ORDER BY reserved DESC;

[User] Only show the top 50 results.

[Assistant] SELECT reserved, available, manufacturer FROM socialmedia.groups ORDER BY reserved DESC LIMIT 50;


[User] Get all groups.

[Assistant] SELECT * FROM socialmedia.groups;

[User] Can you order these by reserved ascending?

[Assistant] SELECT * FROM socialmedia.groups ORDER BY reserved ASC;

[User] Show only 5 records.

[Assistant] SELECT * FROM socialmedia.groups ORDER BY reserved ASC LIMIT 5;


[User] Show me all groups.

[Assistant] SELECT * FROM socialmedia.groups;

[User] Order the output by video_url ascending.

[Assistant] SELECT * FROM socialmedia.groups ORDER BY video_url ASC;

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

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


[User] List all messages.

[Assistant] SELECT * FROM socialmedia.messages;

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

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

[User] Get the distribution of messages across different title values.

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


[User] Retrieve updated_at, user_id, rating for every group.

[Assistant] SELECT updated_at, user_id, rating FROM socialmedia.groups;

[User] Order the output by user_id ascending.

[Assistant] SELECT updated_at, user_id, rating FROM socialmedia.groups ORDER BY user_id ASC;

[User] Show only 100 records.

[Assistant] SELECT updated_at, user_id, rating FROM socialmedia.groups ORDER BY user_id ASC LIMIT 100;


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.reviews (
  message_id integer PRIMARY KEY -- unique identifier,
  edited_at date,
  views varchar,
  categories text NOT NULL,
  user_id character varying(256),
  attachment_url character varying(256),
  thumbnail char
)

CREATE TABLE e-commerce.inventory (
  product_id character varying(64) NOT NULL -- unique identifier,
  expires_at date,
  description text,
  manufacturer text,
  featured_rank char,
  rating character varying(64) NOT NULL,
  quantity char
)

[User] Show me quantity, product_id, expires_at for all inventory.

[Assistant] SELECT quantity, product_id, expires_at FROM e-commerce.inventory;

[User] List inventory that have manufacturer LIKE 'A%'.

[Assistant] SELECT quantity, product_id, expires_at FROM e-commerce.inventory WHERE manufacturer LIKE 'A%';

[User] Restrict the output to 15 items.

[Assistant] SELECT quantity, product_id, expires_at FROM e-commerce.inventory WHERE manufacturer LIKE 'A%' LIMIT 15;


[User] What are the product_id, expires_at, description of each inventory?

[Assistant] SELECT product_id, expires_at, description FROM e-commerce.inventory;

[User] Get inventory that match product_id LIKE 'A%'.

[Assistant] SELECT product_id, expires_at, description FROM e-commerce.inventory WHERE product_id LIKE 'A%';

[User] Get the distribution of inventory across different description values.

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


[User] Get description, featured_rank, quantity from all inventory.

[Assistant] SELECT description, featured_rank, quantity FROM e-commerce.inventory;

[User] Show the results sorted by manufacturer descending.

[Assistant] SELECT description, featured_rank, quantity FROM e-commerce.inventory ORDER BY manufacturer DESC;

[User] Restrict the output to 20 items.

[Assistant] SELECT description, featured_rank, quantity FROM e-commerce.inventory ORDER BY manufacturer DESC LIMIT 20;


[User] Show me thumbnail, attachment_url, categories for all reviews.

[Assistant] SELECT thumbnail, attachment_url, categories FROM e-commerce.reviews;

[User] Can you order these by attachment_url descending?

[Assistant] SELECT thumbnail, attachment_url, categories FROM e-commerce.reviews ORDER BY attachment_url DESC;

[User] What is the average categories for each edited_at in reviews?

[Assistant] SELECT edited_at, AVERAGE(categories) AS average_categories FROM e-commerce.reviews GROUP BY edited_at;


[User] Get all inventory.

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

[User] Show the results sorted by product_id descending.

[Assistant] SELECT * FROM e-commerce.inventory ORDER BY product_id DESC;

[User] Only show the top 50 results.

[Assistant] SELECT * FROM e-commerce.inventory ORDER BY product_id DESC LIMIT 50;


[User] Retrieve rating, product_id, featured_rank for every inventory.

[Assistant] SELECT rating, product_id, featured_rank FROM e-commerce.inventory;

[User] List inventory that have featured_rank LIKE 'A%'.

[Assistant] SELECT rating, product_id, featured_rank FROM e-commerce.inventory WHERE featured_rank LIKE 'A%';

[User] Restrict the output to 25 items.

[Assistant] SELECT rating, product_id, featured_rank FROM e-commerce.inventory WHERE featured_rank LIKE 'A%' LIMIT 25;


[User] Show me edited_at, categories, thumbnail for all reviews.

[Assistant] SELECT edited_at, categories, thumbnail FROM e-commerce.reviews;

[User] Can you order these by attachment_url ascending?

[Assistant] SELECT edited_at, categories, thumbnail FROM e-commerce.reviews ORDER BY attachment_url ASC;

[User] Return just 10 rows.

[Assistant] SELECT edited_at, categories, thumbnail FROM e-commerce.reviews ORDER BY attachment_url ASC LIMIT 10;


[User] Get all reviews.

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

[User] Show me reviews with edited_at > '2023-01-01'.

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

[User] Show the results sorted by attachment_url ascending.

[Assistant] SELECT * FROM e-commerce.reviews WHERE edited_at > '2023-01-01' ORDER BY attachment_url ASC;


[User] Get all reviews.

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

[User] List reviews that have views LIKE 'A%'.

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

[User] Restrict the output to 20 items.

[Assistant] SELECT * FROM e-commerce.reviews WHERE views LIKE 'A%' LIMIT 20;


[User] Display all inventory.

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

[User] List inventory that have rating LIKE 'A%'.

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

[User] Get the distribution of inventory across different expires_at values.

[Assistant] SELECT expires_at, COUNT(*) AS count FROM e-commerce.inventory GROUP BY expires_at 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.shipping (
  barcode integer PRIMARY KEY -- unique identifier,
  created_at timestamp,
  published_at date,
  cost numeric(38,14),
  featured_rank char,
  category character varying(128),
  order_id text NOT NULL -- reference to orders.id,
  FOREIGN KEY (order_id) REFERENCES orders(id)
)

CREATE TABLE e-commerce.inventory (
  id varchar PRIMARY KEY -- unique identifier,
  updated_at timestamp without time zone,
  rating varchar NOT NULL,
  name varchar,
  description varchar NOT NULL,
  cost decimal,
  discount smallint,
  image_url text,
  shippin_id integer -- reference to shipping.barcode,
  FOREIGN KEY (shippin_id) REFERENCES shipping(barcode)
)

CREATE TABLE e-commerce.orders (
  id varchar PRIMARY KEY -- unique identifier,
  created_at timestamp,
  processed_at timestamp without time zone,
  seller_id text NOT NULL -- identifier for seller,
  buyer_id character varying(128) -- identifier for buyer,
  subtotal bigint,
  shippin_id integer -- reference to shipping.barcode,
  FOREIGN KEY (shippin_id) REFERENCES shipping(barcode)
)

CREATE TABLE e-commerce.order_items (
  id character varying(64) NOT NULL -- unique identifier,
  traded_at timestamp without time zone,
  completed_at date,
  currency character varying(256) NOT NULL,
  exchange_rate character varying(256),
  amount numeric(38,14),
  payment_status character varying(64) NOT NULL
)

[User] Display all inventory.

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

[User] Sort the results by updated_at ascending.

[Assistant] SELECT * FROM e-commerce.inventory ORDER BY updated_at ASC;

[User] Show the results sorted by description descending.

[Assistant] SELECT * FROM e-commerce.inventory ORDER BY description DESC;


[User] Retrieve all orders.

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

[User] What shippin_id, buyer_id, cost, category do we have for orders and their associated shipping?

[Assistant] SELECT *, shipping.cost, shipping.category FROM e-commerce.orders JOIN e-commerce.shipping ON orders.shippin_id = shipping.barcode;

[User] Tally up orders by buyer_id.

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


[User] Display all inventory.

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

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

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

[User] Group inventory by discount and show the sum of updated_at.

[Assistant] SELECT discount, SUM(updated_at) AS sum_updated_at FROM e-commerce.inventory GROUP BY discount;


[User] List created_at, cost, category from shipping.

[Assistant] SELECT created_at, cost, category FROM e-commerce.shipping;

[User] List shipping that have published_at > '2023-01-01'.

[Assistant] SELECT created_at, cost, category FROM e-commerce.shipping WHERE published_at > '2023-01-01';

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

[Assistant] SELECT created_at, COUNT(*) AS count FROM e-commerce.shipping GROUP BY created_at 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 (
  barcode text PRIMARY KEY -- unique identifier,
  created_at timestamp,
  published_at date,
  video_url character varying(256) -- identifier for video_url,
  discount smallint,
  quantity character varying(128),
  thumbnail_url char NOT NULL
)

CREATE TABLE e-commerce.order_items (
  invoice_id integer PRIMARY KEY -- unique identifier,
  created_at date,
  completed_at timestamp without time zone,
  customer_id character varying(256) -- identifier for customer,
  delivery_status character varying(128),
  product_id varchar,
  amount smallint
)

CREATE TABLE e-commerce.users (
  user_id character varying(64) NOT NULL -- unique identifier,
  last_active date,
  last_login timestamp,
  country character varying(64),
  salt char,
  bio text,
  inventor_id text -- reference to inventory.barcode,
  FOREIGN KEY (inventor_id) REFERENCES inventory(barcode)
)

[User] Show me all users.

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

[User] Get bio, inventor_id, discount, published_at by joining users with inventory.

[Assistant] SELECT *, inventory.discount, inventory.published_at FROM e-commerce.users JOIN e-commerce.inventory ON users.inventor_id = inventory.barcode;

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

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


[User] Get all users.

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

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

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

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

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


[User] List all users.

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

[User] Sort the results by country descending.

[Assistant] SELECT * FROM e-commerce.users ORDER BY country DESC;

[User] Get the distribution of users across different salt values.

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


[User] Display all users.

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

[User] Retrieve users where last_login > '2023-01-01'.

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

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

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


[User] Show me all users.

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

[User] Show me salt, user_id, created_at, discount from users and their related inventory.

[Assistant] SELECT *, inventory.created_at, inventory.discount FROM e-commerce.users JOIN e-commerce.inventory ON users.inventor_id = inventory.barcode;

[User] Get average of user_id by salt from users.

[Assistant] SELECT salt, AVERAGE(user_id) AS average_user_id FROM e-commerce.users GROUP BY salt;


[User] Get country, bio, inventor_id from all users.

[Assistant] SELECT country, bio, inventor_id FROM e-commerce.users;

[User] Show me users with user_id LIKE 'A%'.

[Assistant] SELECT country, bio, inventor_id FROM e-commerce.users WHERE user_id LIKE 'A%';

[User] Restrict the output to 20 items.

[Assistant] SELECT country, bio, inventor_id FROM e-commerce.users WHERE user_id LIKE 'A%' LIMIT 20;


[User] What are the last_active, country, inventor_id of each user?

[Assistant] SELECT last_active, country, inventor_id FROM e-commerce.users;

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

[Assistant] SELECT last_active, country, inventor_id FROM e-commerce.users WHERE last_login > '2023-01-01';

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

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


[User] Display all users.

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

[User] Show me salt, inventor_id, published_at, video_url from users and their related inventory.

[Assistant] SELECT *, inventory.published_at, inventory.video_url FROM e-commerce.users JOIN e-commerce.inventory ON users.inventor_id = inventory.barcode;

[User] Calculate average of country for each salt in users.

[Assistant] SELECT salt, AVERAGE(country) AS average_country FROM e-commerce.users GROUP BY salt;


[User] Retrieve country, inventor_id, last_active for every user.

[Assistant] SELECT country, inventor_id, last_active FROM e-commerce.users;

[User] Find users modified within the last hour.

[Assistant] SELECT country, inventor_id, last_active FROM e-commerce.users WHERE last_active >= CURRENT_TIMESTAMP - INTERVAL '1 hour';

[User] Show only 5 records.

[Assistant] SELECT country, inventor_id, last_active FROM e-commerce.users WHERE last_active >= CURRENT_TIMESTAMP - INTERVAL '1 hour' LIMIT 5;


[User] List all users.

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

[User] What country, last_active, published_at, video_url do we have for users and their associated inventory?

[Assistant] SELECT *, inventory.published_at, inventory.video_url FROM e-commerce.users JOIN e-commerce.inventory ON users.inventor_id = inventory.barcode;

[User] Only show the top 100 results.

[Assistant] SELECT *, inventory.published_at, inventory.video_url FROM e-commerce.users JOIN e-commerce.inventory ON users.inventor_id = inventory.barcode LIMIT 100;


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.posts (
  comment_id character varying(64) NOT NULL -- unique identifier,
  created_at date,
  published_at timestamp without time zone,
  message character varying(256),
  author_id char -- identifier for author,
  title character varying(64),
  thumbnail character varying(128) NOT NULL,
  body text,
  follower_id integer -- reference to followers.transaction_id,
  FOREIGN KEY (follower_id) REFERENCES followers(transaction_id)
)

CREATE TABLE socialmedia.followers (
  transaction_id integer PRIMARY KEY -- unique identifier,
  cancelled_at timestamp without time zone,
  traded_at timestamp without time zone,
  amount decimal,
  customer_id character varying(256) -- identifier for customer,
  card_type char
)

[User] List all posts.

[Assistant] SELECT * FROM socialmedia.posts;

[User] Get title, author_id, cancelled_at, traded_at by joining posts with followers.

[Assistant] SELECT *, followers.cancelled_at, followers.traded_at FROM socialmedia.posts JOIN socialmedia.followers ON posts.follower_id = followers.transaction_id;

[User] What is the min author_id for each thumbnail in posts?

[Assistant] SELECT thumbnail, MIN(author_id) AS min_author_id FROM socialmedia.posts GROUP BY thumbnail;


[User] Get title, author_id, body from all posts.

[Assistant] SELECT title, author_id, body FROM socialmedia.posts;

[User] Can you order these by author_id ascending?

[Assistant] SELECT title, author_id, body FROM socialmedia.posts ORDER BY author_id ASC;

[User] Return just 5 rows.

[Assistant] SELECT title, author_id, body FROM socialmedia.posts ORDER BY author_id ASC LIMIT 5;


[User] Show me author_id, comment_id, message for all posts.

[Assistant] SELECT author_id, comment_id, message FROM socialmedia.posts;

[User] Can you order these by created_at descending?

[Assistant] SELECT author_id, comment_id, message FROM socialmedia.posts ORDER BY created_at DESC;

[User] Limit the results to 10 rows.

[Assistant] SELECT author_id, comment_id, message FROM socialmedia.posts ORDER BY created_at DESC LIMIT 10;


[User] List author_id, thumbnail, body from posts.

[Assistant] SELECT author_id, thumbnail, body FROM socialmedia.posts;

[User] Find posts where author_id LIKE 'A%'.

[Assistant] SELECT author_id, thumbnail, body FROM socialmedia.posts WHERE author_id LIKE 'A%';

[User] Can you order these by message descending?

[Assistant] SELECT author_id, thumbnail, body FROM socialmedia.posts WHERE author_id LIKE 'A%' ORDER BY message DESC;


[User] What are the published_at, author_id, follower_id of each post?

[Assistant] SELECT published_at, author_id, follower_id FROM socialmedia.posts;

[User] Sort the results by author_id ascending.

[Assistant] SELECT published_at, author_id, follower_id FROM socialmedia.posts ORDER BY author_id ASC;

[User] Show the results sorted by message descending.

[Assistant] SELECT published_at, author_id, follower_id FROM socialmedia.posts ORDER BY message DESC;


[User] Get author_id, body, comment_id from all posts.

[Assistant] SELECT author_id, body, comment_id FROM socialmedia.posts;

[User] Retrieve posts where created_at > '2023-01-01'.

[Assistant] SELECT author_id, body, comment_id FROM socialmedia.posts WHERE created_at > '2023-01-01';

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

[Assistant] SELECT author_id, body, comment_id FROM socialmedia.posts WHERE created_at > '2023-01-01' ORDER BY message DESC;


[User] Get all posts.

[Assistant] SELECT * FROM socialmedia.posts;

[User] Order the output by message ascending.

[Assistant] SELECT * FROM socialmedia.posts ORDER BY message ASC;

[User] How many posts are there per published_at?

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


[User] Get published_at, message, title from all posts.

[Assistant] SELECT published_at, message, title FROM socialmedia.posts;

[User] Order the output by author_id ascending.

[Assistant] SELECT published_at, message, title FROM socialmedia.posts ORDER BY author_id ASC;

[User] Show only 20 records.

[Assistant] SELECT published_at, message, title FROM socialmedia.posts ORDER BY author_id ASC LIMIT 20;


[User] What are the message, created_at, thumbnail of each post?

[Assistant] SELECT message, created_at, thumbnail FROM socialmedia.posts;

[User] What message, created_at, card_type, customer_id do we have for posts and their associated followers?

[Assistant] SELECT message, created_at, thumbnail, followers.card_type, followers.customer_id FROM socialmedia.posts JOIN socialmedia.followers ON posts.follower_id = followers.transaction_id;

[User] Restrict the output to 5 items.

[Assistant] SELECT message, created_at, thumbnail, followers.card_type, followers.customer_id FROM socialmedia.posts JOIN socialmedia.followers ON posts.follower_id = followers.transaction_id LIMIT 5;


[User] Display all posts.

[Assistant] SELECT * FROM socialmedia.posts;

[User] Can you order these by published_at ascending?

[Assistant] SELECT * FROM socialmedia.posts ORDER BY published_at ASC;

[User] Calculate sum of message for each comment_id in posts.

[Assistant] SELECT comment_id, SUM(message) AS sum_message FROM socialmedia.posts GROUP BY comment_id;


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.departments (
  venue_id varchar PRIMARY KEY -- unique identifier,
  updated_at timestamp without time zone,
  name varchar,
  type char,
  location_lat character varying(64),
  country char,
  geo_point character varying(64),
  state text NOT NULL,
  longitude text,
  medical_record_id text -- reference to medical_records.order_id,
  doctor_id text -- reference to doctors.post_id,
  FOREIGN KEY (medical_record_id) REFERENCES medical_records(order_id),
  FOREIGN KEY (doctor_id) REFERENCES doctors(post_id)
)

CREATE TABLE healthcare.doctors (
  post_id varchar PRIMARY KEY -- unique identifier,
  updated_at date,
  created_at date,
  views text,
  message character varying(256),
  attachment_url character varying(256),
  title character varying(128),
  tags char,
  reply_to_id char -- identifier for reply_to
)

CREATE TABLE healthcare.medical_records (
  order_id varchar PRIMARY KEY -- unique identifier,
  cancelled_at date,
  delivery_status text,
  quantity character varying(64),
  card_type varchar,
  payment_status character varying(64)
)

[User] Get all departments.

[Assistant] SELECT * FROM healthcare.departments;

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

[Assistant] SELECT * FROM healthcare.departments WHERE updated_at > '2023-12-01';

[User] How many departments are there per type?

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


[User] List all departments.

[Assistant] SELECT * FROM healthcare.departments;

[User] List departments with dates created yesterday.

[Assistant] SELECT * FROM healthcare.departments WHERE updated_at = CURRENT_DATE - INTERVAL '1 day';

[User] Get the distribution of departments across different medical_record_id values.

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


[User] List type, country, name from departments.

[Assistant] SELECT type, country, name FROM healthcare.departments;

[User] What updated_at, location_lat, payment_status, delivery_status do we have for departments and their associated medical_records?

[Assistant] SELECT type, country, name, medical_records.payment_status, medical_records.delivery_status FROM healthcare.departments JOIN healthcare.medical_records ON departments.medical_record_id = medical_records.order_id;

[User] Can you order these by updated_at descending?

[Assistant] SELECT type, country, name, medical_records.payment_status, medical_records.delivery_status FROM healthcare.departments JOIN healthcare.medical_records ON departments.medical_record_id = medical_records.order_id ORDER BY updated_at DESC;


[User] List all departments.

[Assistant] SELECT * FROM healthcare.departments;

[User] Show the results sorted by longitude descending.

[Assistant] SELECT * FROM healthcare.departments ORDER BY longitude DESC;

[User] Count the number of departments in each type category.

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


[User] Retrieve location_lat, updated_at, longitude for every department.

[Assistant] SELECT location_lat, updated_at, longitude FROM healthcare.departments;

[User] Show me departments with longitude LIKE 'A%'.

[Assistant] SELECT location_lat, updated_at, longitude FROM healthcare.departments WHERE longitude LIKE 'A%';

[User] Tally up departments by location_lat.

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


[User] Retrieve all departments.

[Assistant] SELECT * FROM healthcare.departments;

[User] Sort the results by geo_point ascending.

[Assistant] SELECT * FROM healthcare.departments ORDER BY geo_point ASC;

[User] Calculate average of name for each name in departments.

[Assistant] SELECT name, AVERAGE(name) AS average_name FROM healthcare.departments GROUP BY name;


[User] What are the updated_at, name, type of each department?

[Assistant] SELECT updated_at, name, type FROM healthcare.departments;

[User] Get departments that match doctor_id LIKE 'A%'.

[Assistant] SELECT updated_at, name, type FROM healthcare.departments WHERE doctor_id LIKE 'A%';

[User] Tally up departments by longitude.

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


[User] List all departments.

[Assistant] SELECT * FROM healthcare.departments;

[User] List departments that have state LIKE 'A%'.

[Assistant] SELECT * FROM healthcare.departments WHERE state LIKE 'A%';

[User] Show the results sorted by updated_at ascending.

[Assistant] SELECT * FROM healthcare.departments WHERE state LIKE 'A%' ORDER BY updated_at ASC;


[User] Retrieve country, name, doctor_id for every department.

[Assistant] SELECT country, name, doctor_id FROM healthcare.departments;

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

[Assistant] SELECT country, name, doctor_id FROM healthcare.departments WHERE updated_at >= CURRENT_DATE - INTERVAL '7 days';

[User] Sort the results by type ascending.

[Assistant] SELECT country, name, doctor_id FROM healthcare.departments WHERE updated_at >= CURRENT_DATE - INTERVAL '7 days' ORDER BY type ASC;


[User] List all departments.

[Assistant] SELECT * FROM healthcare.departments;

[User] Show me departments with doctor_id LIKE 'A%'.

[Assistant] SELECT * FROM healthcare.departments WHERE doctor_id LIKE 'A%';

[User] Return just 15 rows.

[Assistant] SELECT * FROM healthcare.departments WHERE doctor_id LIKE 'A%' LIMIT 15;


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.assignments (
  person_id varchar PRIMARY KEY -- unique identifier,
  last_active timestamp,
  website text NOT NULL,
  membership_level char,
  last_login date NOT NULL,
  password_hash char NOT NULL,
  country varchar NOT NULL,
  nationality character varying(64) NOT NULL,
  is_verified bit NOT NULL -- indicates if verified is true,
  course_id text -- reference to courses.comment_id,
  grade_id text -- reference to grades.transaction_id,
  FOREIGN KEY (course_id) REFERENCES courses(comment_id),
  FOREIGN KEY (grade_id) REFERENCES grades(transaction_id)
)

CREATE TABLE education.grades (
  transaction_id varchar PRIMARY KEY -- unique identifier,
  updated_at timestamp,
  processed_at date,
  customer_id character varying(256),
  payer_id character varying(256),
  description varchar NOT NULL,
  notes character varying(128),
  category text
)

CREATE TABLE education.courses (
  comment_id varchar PRIMARY KEY -- unique identifier,
  edited_at date,
  created_at timestamp,
  media_url character varying(256),
  thumbnail text NOT NULL,
  shares varchar,
  reply_to_id char NOT NULL -- identifier for reply_to
)

CREATE TABLE education.students (
  person_id integer PRIMARY KEY -- unique identifier,
  created_at date,
  birth_date date NOT NULL,
  website text,
  is_active boolean,
  token varchar,
  phone character varying(64),
  state char,
  age character varying(64),
  course_id text NOT NULL -- reference to courses.comment_id,
  FOREIGN KEY (course_id) REFERENCES courses(comment_id)
)

[User] Show me all students.

[Assistant] SELECT * FROM education.students;

[User] Get students that match birth_date > '2023-01-01'.

[Assistant] SELECT * FROM education.students WHERE birth_date > '2023-01-01';

[User] Show only 5 records.

[Assistant] SELECT * FROM education.students WHERE birth_date > '2023-01-01' 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 events.patients (
  user_id integer PRIMARY KEY -- unique identifier,
  updated_at date,
  profile_picture_url char NOT NULL,
  language character varying(128),
  bio character varying(64),
  token text,
  product_id text -- reference to products.sku,
  FOREIGN KEY (product_id) REFERENCES products(sku)
)

CREATE TABLE events.messages (
  content_id text PRIMARY KEY -- unique identifier,
  edited_at date,
  published_at timestamp without time zone,
  views character varying(128) NOT NULL,
  title character varying(128),
  image_url text,
  patient_id integer NOT NULL -- reference to patients.user_id,
  FOREIGN KEY (patient_id) REFERENCES patients(user_id)
)

CREATE TABLE events.products (
  sku varchar PRIMARY KEY -- unique identifier,
  updated_at date,
  created_at date,
  price bigint NOT NULL,
  views varchar,
  thumbnail_url character varying(256) NOT NULL,
  brand char,
  rating character varying(256),
  backorder varchar,
  message_id text NOT NULL -- reference to messages.content_id,
  FOREIGN KEY (message_id) REFERENCES messages(content_id)
)

CREATE TABLE events.accounts (
  account_id text PRIMARY KEY -- unique identifier,
  created_at timestamp,
  processed_at timestamp,
  reconciliation_status varchar NOT NULL,
  approval_status character varying(256),
  status char,
  product_id text -- reference to products.sku,
  FOREIGN KEY (product_id) REFERENCES products(sku)
)

[User] Get product_id, updated_at, token from all patients.

[Assistant] SELECT product_id, updated_at, token FROM events.patients;

[User] Show me patients with token LIKE 'A%'.

[Assistant] SELECT product_id, updated_at, token FROM events.patients WHERE token LIKE 'A%';

[User] Show only 20 records.

[Assistant] SELECT product_id, updated_at, token FROM events.patients WHERE token LIKE 'A%' LIMIT 20;


[User] What are the updated_at, language, product_id of each patient?

[Assistant] SELECT updated_at, language, product_id FROM events.patients;

[User] Find patients older than 6 months.

[Assistant] SELECT updated_at, language, product_id FROM events.patients WHERE updated_at <= CURRENT_DATE - INTERVAL '6 months';

[User] Get min of bio by updated_at from patients.

[Assistant] SELECT updated_at, MIN(bio) AS min_bio FROM events.patients GROUP BY updated_at;


[User] Get all patients.

[Assistant] SELECT * FROM events.patients;

[User] Sort the results by updated_at descending.

[Assistant] SELECT * FROM events.patients ORDER BY updated_at DESC;

[User] Sort the results by product_id descending.

[Assistant] SELECT * FROM events.patients ORDER BY product_id DESC;


[User] Get approval_status, status, product_id from all accounts.

[Assistant] SELECT approval_status, status, product_id FROM events.accounts;

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

[Assistant] SELECT approval_status, status, product_id FROM events.accounts WHERE status LIKE 'A%';

[User] Count the number of accounts in each product_id category.

[Assistant] SELECT product_id, COUNT(*) AS count FROM events.accounts GROUP BY product_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 restaurant.transactions (
  payment_id text PRIMARY KEY -- unique identifier,
  processed_at date,
  created_at date,
  currency varchar NOT NULL,
  tax bigint,
  price integer NOT NULL,
  subtotal numeric,
  post_id text -- reference to posts.message_id,
  FOREIGN KEY (post_id) REFERENCES posts(message_id)
)

CREATE TABLE restaurant.posts (
  message_id text PRIMARY KEY -- unique identifier,
  edited_at date,
  updated_at date,
  format character varying(64),
  reply_to_id text -- identifier for reply_to,
  keywords character varying(128),
  image_url char,
  author_id text NOT NULL,
  attachment_url text NOT NULL,
  transaction_id text -- reference to transactions.payment_id,
  FOREIGN KEY (transaction_id) REFERENCES transactions(payment_id)
)

CREATE TABLE restaurant.patients (
  employee_id varchar PRIMARY KEY -- unique identifier,
  created_at timestamp,
  joined_at timestamp without time zone,
  first_name character varying(128),
  last_login timestamp,
  membership_level char,
  birth_date timestamp without time zone,
  post_id text -- reference to posts.message_id,
  FOREIGN KEY (post_id) REFERENCES posts(message_id)
)

[User] What are the price, processed_at, tax of each transaction?

[Assistant] SELECT price, processed_at, tax FROM restaurant.transactions;

[User] Can you order these by currency ascending?

[Assistant] SELECT price, processed_at, tax FROM restaurant.transactions ORDER BY currency ASC;

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

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


[User] Show me first_name, birth_date, last_login for all patients.

[Assistant] SELECT first_name, birth_date, last_login FROM restaurant.patients;

[User] Retrieve last_login, created_at, keywords, edited_at showing the relationship between patients and posts.

[Assistant] SELECT first_name, birth_date, last_login, posts.keywords, posts.edited_at FROM restaurant.patients JOIN restaurant.posts ON patients.post_id = posts.message_id;

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

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


[User] List attachment_url, keywords, reply_to_id from posts.

[Assistant] SELECT attachment_url, keywords, reply_to_id FROM restaurant.posts;

[User] Get posts that match reply_to_id LIKE 'A%'.

[Assistant] SELECT attachment_url, keywords, reply_to_id FROM restaurant.posts WHERE reply_to_id LIKE 'A%';

[User] Show the results sorted by author_id descending.

[Assistant] SELECT attachment_url, keywords, reply_to_id FROM restaurant.posts WHERE reply_to_id LIKE 'A%' ORDER BY author_id DESC;


[User] Get last_login, birth_date, joined_at from all patients.

[Assistant] SELECT last_login, birth_date, joined_at FROM restaurant.patients;

[User] Show the results sorted by post_id ascending.

[Assistant] SELECT last_login, birth_date, joined_at FROM restaurant.patients ORDER BY post_id ASC;

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

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


[User] List all transactions.

[Assistant] SELECT * FROM restaurant.transactions;

[User] Get price, post_id, author_id, updated_at by joining transactions with posts.

[Assistant] SELECT *, posts.author_id, posts.updated_at FROM restaurant.transactions JOIN restaurant.posts ON transactions.post_id = posts.message_id;

[User] What is the sum currency for each currency in transactions?

[Assistant] SELECT currency, SUM(currency) AS sum_currency FROM restaurant.transactions GROUP BY currency;


[User] Get reply_to_id, attachment_url, format from all posts.

[Assistant] SELECT reply_to_id, attachment_url, format FROM restaurant.posts;

[User] Show me posts with reply_to_id LIKE 'A%'.

[Assistant] SELECT reply_to_id, attachment_url, format FROM restaurant.posts WHERE reply_to_id LIKE 'A%';

[User] Count the number of posts in each author_id category.

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


[User] List all patients.

[Assistant] SELECT * FROM restaurant.patients;

[User] Show me birth_date, joined_at, transaction_id, attachment_url from patients and their related posts.

[Assistant] SELECT *, posts.transaction_id, posts.attachment_url FROM restaurant.patients JOIN restaurant.posts ON patients.post_id = posts.message_id;

[User] Show only 100 records.

[Assistant] SELECT *, posts.transaction_id, posts.attachment_url FROM restaurant.patients JOIN restaurant.posts ON patients.post_id = posts.message_id LIMIT 100;


[User] What are the created_at, last_login, membership_level of each patient?

[Assistant] SELECT created_at, last_login, membership_level FROM restaurant.patients;

[User] Sort the results by birth_date ascending.

[Assistant] SELECT created_at, last_login, membership_level FROM restaurant.patients ORDER BY birth_date ASC;

[User] Restrict the output to 5 items.

[Assistant] SELECT created_at, last_login, membership_level FROM restaurant.patients ORDER BY birth_date ASC LIMIT 5;


[User] Retrieve subtotal, post_id, processed_at for every transaction.

[Assistant] SELECT subtotal, post_id, processed_at FROM restaurant.transactions;

[User] Retrieve currency, post_id, keywords, updated_at showing the relationship between transactions and posts.

[Assistant] SELECT subtotal, post_id, processed_at, posts.keywords, posts.updated_at FROM restaurant.transactions JOIN restaurant.posts ON transactions.post_id = posts.message_id;

[User] Return just 20 rows.

[Assistant] SELECT subtotal, post_id, processed_at, posts.keywords, posts.updated_at FROM restaurant.transactions JOIN restaurant.posts ON transactions.post_id = posts.message_id LIMIT 20;


[User] Get all transactions.

[Assistant] SELECT * FROM restaurant.transactions;

[User] What currency, subtotal, edited_at, keywords do we have for transactions and their associated posts?

[Assistant] SELECT *, posts.edited_at, posts.keywords FROM restaurant.transactions JOIN restaurant.posts ON transactions.post_id = posts.message_id;

[User] Show the results sorted by post_id ascending.

[Assistant] SELECT *, posts.edited_at, posts.keywords FROM restaurant.transactions JOIN restaurant.posts ON transactions.post_id = posts.message_id ORDER BY post_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 e-commerce.shipping (
  item_id varchar PRIMARY KEY -- unique identifier,
  created_at timestamp,
  expires_at timestamp,
  price bigint,
  name character varying(64),
  thumbnail_url character varying(64),
  currency varchar,
  msrp character varying(256),
  featured_rank text,
  categorie_id integer NOT NULL -- reference to categories.transaction_id,
  review_id integer NOT NULL -- reference to reviews.message_id,
  FOREIGN KEY (categorie_id) REFERENCES categories(transaction_id),
  FOREIGN KEY (review_id) REFERENCES reviews(message_id)
)

CREATE TABLE e-commerce.categories (
  transaction_id integer PRIMARY KEY -- unique identifier,
  updated_at date,
  price decimal,
  product_id character varying(64) -- identifier for product,
  quantity character varying(64),
  exchange_rate character varying(128) NOT NULL
)

CREATE TABLE e-commerce.reviews (
  message_id integer PRIMARY KEY -- unique identifier,
  created_at date,
  reply_to_id character varying(256) -- identifier for reply_to,
  keywords character varying(64) NOT NULL,
  message character varying(256),
  likes character varying(256),
  categorie_id integer NOT NULL -- reference to categories.transaction_id,
  FOREIGN KEY (categorie_id) REFERENCES categories(transaction_id)
)

[User] Show me expires_at, categorie_id, msrp for all shipping.

[Assistant] SELECT expires_at, categorie_id, msrp FROM e-commerce.shipping;

[User] Find shipping where currency LIKE 'A%'.

[Assistant] SELECT expires_at, categorie_id, msrp FROM e-commerce.shipping WHERE currency LIKE 'A%';

[User] Tally up shipping by msrp.

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


[User] Display all shipping.

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

[User] Retrieve shipping where expires_at > '2023-01-01'.

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

[User] Show me average of msrp grouped by categorie_id for shipping.

[Assistant] SELECT categorie_id, AVERAGE(msrp) AS average_msrp FROM e-commerce.shipping GROUP BY categorie_id;


[User] Display all shipping.

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

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

[Assistant] SELECT * FROM e-commerce.shipping WHERE created_at >= CURRENT_DATE - INTERVAL '7 days';

[User] Sort the results by expires_at ascending.

[Assistant] SELECT * FROM e-commerce.shipping WHERE created_at >= CURRENT_DATE - INTERVAL '7 days' ORDER BY expires_at ASC;


[User] Show me msrp, currency, expires_at for all shipping.

[Assistant] SELECT msrp, currency, expires_at FROM e-commerce.shipping;

[User] Retrieve shipping where price > 43.

[Assistant] SELECT msrp, currency, expires_at FROM e-commerce.shipping WHERE price > 43;

[User] Show me the count of shipping grouped by featured_rank.

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


[User] Get message, reply_to_id, likes from all reviews.

[Assistant] SELECT message, reply_to_id, likes FROM e-commerce.reviews;

[User] List reviews with dates from last week.

[Assistant] SELECT message, reply_to_id, likes FROM e-commerce.reviews WHERE created_at >= CURRENT_DATE - INTERVAL '7 days';

[User] Get the distribution of reviews across different message values.

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


[User] What are the likes, reply_to_id, created_at of each review?

[Assistant] SELECT likes, reply_to_id, created_at FROM e-commerce.reviews;

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

[Assistant] SELECT likes, reply_to_id, created_at FROM e-commerce.reviews ORDER BY categorie_id ASC;

[User] What is the average keywords for each reply_to_id in reviews?

[Assistant] SELECT reply_to_id, AVERAGE(keywords) AS average_keywords FROM e-commerce.reviews GROUP BY reply_to_id;


[User] Show me reply_to_id, likes, created_at for all reviews.

[Assistant] SELECT reply_to_id, likes, created_at FROM e-commerce.reviews;

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

[Assistant] SELECT reply_to_id, likes, created_at FROM e-commerce.reviews ORDER BY message ASC;

[User] Tally up reviews by categorie_id.

[Assistant] SELECT categorie_id, COUNT(*) AS count FROM e-commerce.reviews GROUP BY categorie_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.medical_records (
  content_id text PRIMARY KEY -- unique identifier,
  created_at date,
  author_id character varying(128) NOT NULL,
  shares text
)

CREATE TABLE healthcare.prescriptions (
  payment_id character varying(64) NOT NULL -- unique identifier,
  processed_at date,
  due_date date,
  reconciliation_status char,
  amount numeric(38,14)
)

[User] List amount, payment_id, reconciliation_status from prescriptions.

[Assistant] SELECT amount, payment_id, reconciliation_status FROM healthcare.prescriptions;

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

[Assistant] SELECT amount, payment_id, reconciliation_status FROM healthcare.prescriptions WHERE processed_at > '2023-12-01';

[User] Show me the count of prescriptions grouped by reconciliation_status.

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


[User] Show me due_date, payment_id, amount for all prescriptions.

[Assistant] SELECT due_date, payment_id, amount FROM healthcare.prescriptions;

[User] Retrieve prescriptions where the date is older than 6 months.

[Assistant] SELECT due_date, payment_id, amount FROM healthcare.prescriptions WHERE processed_at <= CURRENT_DATE - INTERVAL '6 months';

[User] Get the distribution of prescriptions across different due_date values.

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


[User] Show me processed_at, due_date, reconciliation_status for all prescriptions.

[Assistant] SELECT processed_at, due_date, reconciliation_status FROM healthcare.prescriptions;

[User] Find prescriptions where reconciliation_status LIKE 'A%'.

[Assistant] SELECT processed_at, due_date, reconciliation_status FROM healthcare.prescriptions WHERE reconciliation_status LIKE 'A%';

[User] Show the results sorted by amount ascending.

[Assistant] SELECT processed_at, due_date, reconciliation_status FROM healthcare.prescriptions WHERE reconciliation_status LIKE 'A%' ORDER BY amount ASC;


[User] Display all prescriptions.

[Assistant] SELECT * FROM healthcare.prescriptions;

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

[Assistant] SELECT * FROM healthcare.prescriptions ORDER BY processed_at DESC;

[User] Show only 25 records.

[Assistant] SELECT * FROM healthcare.prescriptions ORDER BY processed_at DESC LIMIT 25;


[User] List all medical_records.

[Assistant] SELECT * FROM healthcare.medical_records;

[User] Sort the results by shares ascending.

[Assistant] SELECT * FROM healthcare.medical_records ORDER BY shares ASC;

[User] Only show the top 5 results.

[Assistant] SELECT * FROM healthcare.medical_records ORDER BY shares ASC LIMIT 5;


[User] Show me created_at, author_id, shares for all medical_records.

[Assistant] SELECT created_at, author_id, shares FROM healthcare.medical_records;

[User] Find medical_records created yesterday.

[Assistant] SELECT created_at, author_id, shares FROM healthcare.medical_records WHERE created_at = CURRENT_DATE - INTERVAL '1 day';

[User] Limit the results to 5 rows.

[Assistant] SELECT created_at, author_id, shares FROM healthcare.medical_records WHERE created_at = CURRENT_DATE - INTERVAL '1 day' LIMIT 5;


[User] Show me all medical_records.

[Assistant] SELECT * FROM healthcare.medical_records;

[User] Sort the results by author_id descending.

[Assistant] SELECT * FROM healthcare.medical_records ORDER BY author_id DESC;

[User] Show me the count of medical_records grouped by created_at.

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


[User] Retrieve amount, processed_at, due_date for every prescription.

[Assistant] SELECT amount, processed_at, due_date FROM healthcare.prescriptions;

[User] Show me prescriptions with payment_id LIKE 'A%'.

[Assistant] SELECT amount, processed_at, due_date FROM healthcare.prescriptions WHERE payment_id LIKE 'A%';

[User] Return just 20 rows.

[Assistant] SELECT amount, processed_at, due_date FROM healthcare.prescriptions WHERE payment_id LIKE 'A%' LIMIT 20;


[User] Show me all prescriptions.

[Assistant] SELECT * FROM healthcare.prescriptions;

[User] Find prescriptions between January and March.

[Assistant] SELECT * FROM healthcare.prescriptions WHERE due_date BETWEEN '2023-01-01' AND '2023-03-31';

[User] Get the distribution of prescriptions across different due_date values.

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


[User] Show me all medical_records.

[Assistant] SELECT * FROM healthcare.medical_records;

[User] List medical_records with dates created in the last 30 days.

[Assistant] SELECT * FROM healthcare.medical_records WHERE created_at >= CURRENT_DATE - INTERVAL '30 days';

[User] Return just 20 rows.

[Assistant] SELECT * FROM healthcare.medical_records WHERE created_at >= CURRENT_DATE - INTERVAL '30 days' 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 education.assignments (
  content_id character varying(64) NOT NULL -- unique identifier,
  edited_at date,
  created_at timestamp without time zone,
  message text,
  views char NOT NULL,
  author_id char,
  student_id text NOT NULL -- reference to students.person_id,
  FOREIGN KEY (student_id) REFERENCES students(person_id)
)

CREATE TABLE education.students (
  person_id varchar PRIMARY KEY -- unique identifier,
  updated_at timestamp,
  password_hash char,
  is_verified bit NOT NULL -- indicates if verified is true,
  display_name text NOT NULL,
  first_name character varying(128),
  last_login timestamp,
  membership_level varchar NOT NULL
)

[User] Show me all assignments.

[Assistant] SELECT * FROM education.assignments;

[User] Get assignments that match content_id LIKE 'A%'.

[Assistant] SELECT * FROM education.assignments WHERE content_id LIKE 'A%';

[User] Sort the results by message descending.

[Assistant] SELECT * FROM education.assignments WHERE content_id LIKE 'A%' ORDER BY message DESC;


[User] What are the student_id, author_id, message of each assignment?

[Assistant] SELECT student_id, author_id, message FROM education.assignments;

[User] Show me assignments that were created yesterday.

[Assistant] SELECT student_id, author_id, message FROM education.assignments WHERE edited_at = CURRENT_DATE - INTERVAL '1 day';

[User] Tally up assignments by edited_at.

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


[User] Show me all assignments.

[Assistant] SELECT * FROM education.assignments;

[User] Show the results sorted by views ascending.

[Assistant] SELECT * FROM education.assignments ORDER BY views ASC;

[User] Can you order these by created_at ascending?

[Assistant] SELECT * FROM education.assignments ORDER BY created_at ASC;


[User] Display all assignments.

[Assistant] SELECT * FROM education.assignments;

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

[Assistant] SELECT * FROM education.assignments ORDER BY created_at ASC;

[User] How many assignments are there per message?

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


[User] Display all assignments.

[Assistant] SELECT * FROM education.assignments;

[User] Show me message, author_id, membership_level, password_hash from assignments and their related students.

[Assistant] SELECT *, students.membership_level, students.password_hash FROM education.assignments JOIN education.students ON assignments.student_id = students.person_id;

[User] Limit the results to 5 rows.

[Assistant] SELECT *, students.membership_level, students.password_hash FROM education.assignments JOIN education.students ON assignments.student_id = students.person_id LIMIT 5;


[User] Get author_id, student_id, edited_at from all assignments.

[Assistant] SELECT author_id, student_id, edited_at FROM education.assignments;

[User] Can you order these by edited_at ascending?

[Assistant] SELECT author_id, student_id, edited_at FROM education.assignments ORDER BY edited_at ASC;

[User] Get the distribution of assignments across different message values.

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


[User] Retrieve views, content_id, edited_at for every assignment.

[Assistant] SELECT views, content_id, edited_at FROM education.assignments;

[User] Show me edited_at, created_at, display_name, membership_level from assignments and their related students.

[Assistant] SELECT views, content_id, edited_at, students.display_name, students.membership_level FROM education.assignments JOIN education.students ON assignments.student_id = students.person_id;

[User] Calculate min of student_id for each created_at in assignments.

[Assistant] SELECT created_at, MIN(student_id) AS min_student_id FROM education.assignments GROUP BY created_at;


[User] List student_id, views, created_at from assignments.

[Assistant] SELECT student_id, views, created_at FROM education.assignments;

[User] Get all assignments created yesterday.

[Assistant] SELECT student_id, views, created_at FROM education.assignments WHERE created_at = CURRENT_DATE - INTERVAL '1 day';

[User] Count the number of assignments in each student_id category.

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


[User] Get author_id, student_id, content_id from all assignments.

[Assistant] SELECT author_id, student_id, content_id FROM education.assignments;

[User] Show me message, author_id, password_hash, display_name from assignments and their related students.

[Assistant] SELECT author_id, student_id, content_id, students.password_hash, students.display_name FROM education.assignments JOIN education.students ON assignments.student_id = students.person_id;

[User] Show me min of content_id grouped by edited_at for assignments.

[Assistant] SELECT edited_at, MIN(content_id) AS min_content_id FROM education.assignments GROUP BY edited_at;


[User] List all assignments.

[Assistant] SELECT * FROM education.assignments;

[User] Get assignments that match student_id LIKE 'A%'.

[Assistant] SELECT * FROM education.assignments WHERE student_id LIKE 'A%';

[User] Calculate average of edited_at for each content_id in assignments.

[Assistant] SELECT content_id, AVERAGE(edited_at) AS average_edited_at FROM education.assignments GROUP BY content_id;


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.addresses (
  location_id text PRIMARY KEY -- unique identifier,
  last_inspected timestamp,
  created_at timestamp without time zone,
  location_lon text,
  location_lat char,
  timezone character varying(64),
  operating_hours character varying(128),
  street character varying(64),
  type character varying(128),
  geo_point varchar
)

CREATE TABLE restaurant.clients (
  id integer PRIMARY KEY -- unique identifier,
  updated_at timestamp without time zone,
  phone varchar NOT NULL,
  full_name char,
  is_verified boolean NOT NULL -- indicates if verified is true,
  account_status varchar NOT NULL,
  nationality text,
  status text NOT NULL,
  avatar varchar
)

CREATE TABLE restaurant.items (
  id character varying(64) NOT NULL -- unique identifier,
  expires_at timestamp,
  created_at date,
  backorder char,
  featured_rank character varying(128),
  brand character varying(128),
  video_url character varying(256) NOT NULL,
  views character varying(256),
  category character varying(256),
  addresse_id text NOT NULL -- reference to addresses.location_id,
  FOREIGN KEY (addresse_id) REFERENCES addresses(location_id)
)

CREATE TABLE restaurant.messages (
  comment_id text PRIMARY KEY -- unique identifier,
  updated_at date,
  created_at timestamp without time zone,
  reply_to_id varchar,
  user_id varchar NOT NULL -- identifier for user,
  image_url varchar NOT NULL,
  subject character varying(256) NOT NULL,
  categories varchar NOT NULL,
  media_url character varying(64),
  title varchar NOT NULL
)

[User] Show me all items.

[Assistant] SELECT * FROM restaurant.items;

[User] Retrieve items where backorder LIKE 'A%'.

[Assistant] SELECT * FROM restaurant.items WHERE backorder LIKE 'A%';

[User] Restrict the output to 25 items.

[Assistant] SELECT * FROM restaurant.items WHERE backorder LIKE 'A%' LIMIT 25;


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 character varying(64) NOT NULL -- unique identifier,
  created_at timestamp,
  bio char NOT NULL,
  full_name character varying(128),
  nationality char,
  language text,
  membership_level character varying(64),
  audit_id text NOT NULL -- reference to audits.id,
  FOREIGN KEY (audit_id) REFERENCES audits(id)
)

CREATE TABLE finance.accounts (
  invoice_id text PRIMARY KEY -- unique identifier,
  processed_at timestamp without time zone,
  payment_date timestamp without time zone,
  amount smallint NOT NULL,
  user_id text -- identifier for user,
  reference_number char NOT NULL,
  audit_id text NOT NULL -- reference to audits.id,
  FOREIGN KEY (audit_id) REFERENCES audits(id)
)

CREATE TABLE finance.audits (
  id varchar PRIMARY KEY -- unique identifier,
  created_at timestamp,
  user_id character varying(64),
  author_id character varying(128) -- identifier for author,
  parent_id varchar
)

[User] What are the reference_number, payment_date, user_id of each account?

[Assistant] SELECT reference_number, payment_date, user_id FROM finance.accounts;

[User] Get accounts that match amount > 36.

[Assistant] SELECT reference_number, payment_date, user_id FROM finance.accounts WHERE amount > 36;

[User] Show the results sorted by processed_at ascending.

[Assistant] SELECT reference_number, payment_date, user_id FROM finance.accounts WHERE amount > 36 ORDER BY processed_at ASC;