ChatGPT is wild. I entered "Describe a mysql database schema for tracking the owned books of multiple people" and it came back with the queries to write the tables including foreign keys:
CREATE TABLE people (
id INTEGER PRIMARY KEY,
name VARCHAR(255) NOT NULL
);
CREATE TABLE books (
id INTEGER PRIMARY KEY,
title VARCHAR(255) NOT NULL,
author VARCHAR(255) NOT NULL,
year INTEGER NOT NULL
);
CREATE TABLE owned_books (
person_id INTEGER NOT NULL,
book_id INTEGER NOT NULL,
PRIMARY KEY (person_id, book_id),
FOREIGN KEY (person_id) REFERENCES people(id),
FOREIGN KEY (book_id) REFERENCES books(id)
);
I do things like this regularly so I can do this no problem but having a rough draft dumped in front of me within seconds is handy. It even gives examples of what queries you could run with the data, so I followed up with "What would the query for how many books each person owns look like?"
SELECT p.name, COUNT(ob.book_id) AS num_books
FROM people p
JOIN owned_books ob ON p.id = ob.person_id
GROUP BY p.id
I'm not convinced I'm getting replaced yet but I'm a tiny bit more worried than I was a few weeks ago.