欢迎访问chatgpt中文教程网,学习chatgpt相关知识,以下是正文内容:
CREATE TABLE Author (
author_id INT AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(50),
last_name VARCHAR(50),
birth_date DATE,
nationality VARCHAR(50)
);
CREATE TABLE Publisher (
publisher_id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
address VARCHAR(255),
contact_number VARCHAR(20),
email VARCHAR(100)
);
CREATE TABLE Book (
book_id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(100),
genre VARCHAR(50),
publication_date DATE,
isbn VARCHAR(20) UNIQUE,
author_id INT,
publisher_id INT,
FOREIGN KEY (author_id) REFERENCES Author(author_id),
FOREIGN KEY (publisher_id) REFERENCES Publisher(publisher_id)
);
INSERT INTO Author (first_name, last_name, birth_date)
VALUES ('Iain', 'Banks', '1954-02-16');
INSERT INTO Author (first_name, last_name, birth_date)
VALUES ('Iain', 'M Banks', '1954-02-16');
INSERT INTO Publisher (name, address)
VALUES ('Abacus', 'London');
INSERT INTO Publisher (name, address)
VALUES ('Orbit', 'New York');
INSERT INTO Book (title, author_id, publisher_id, publication_date)
VALUES ('Consider Phlebas', 2, 2, '1988-04-14');
INSERT INTO Book (title, author_id, publisher_id, publication_date)
VALUES ('The Wasp Factory', 1, 1, '1984-02-15');
CREATE VIEW ViewableBooks AS
SELECT Book.title 'Book', Author.first_name 'Author firstname', Author.last_name 'Author surname', Publisher.name 'Publisher', Book.publication_date
FROM Book, Publisher, Author
WHERE Book.author_id = Author.author_id
AND Book.publisher_id = Publisher.publisher_id;
CREATE TABLE Pseudonym (
pseudonym_id INT AUTO_INCREMENT PRIMARY KEY,
pseudonym VARCHAR(100),
author_id INT,
FOREIGN KEY (author_id)
REFERENCES Author(author_id)
);
CREATE TABLE Book (
book_id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(100),
genre VARCHAR(50),
publication_date DATE,
isbn VARCHAR(20) UNIQUE,
pseudonym_id INT,
publisher_id INT,
FOREIGN KEY (pseudonym_id) REFERENCES Pseudonym(pseudonym_id),
FOREIGN KEY (publisher_id) REFERENCES Publisher(publisher_id)
);
CREATE TABLE BookAuthor
(
book_id INT,
pseudonym_id INT,
PRIMARY KEY (book_id, pseudonym_id),
FOREIGN KEY (book_id) REFERENCES Book(book_id),
FOREIGN KEY (pseudonym_id) REFERENCES Pseudonym(pseudonym_id)
);
本文链接:http://xiaogongchang.cn/chatgpt/1140.html
chatgpt4.0有必要付费开吗chatgpt付费版本区别ChatGPT生成Python代码Bito – GPT-4Markdown编辑器gpt-4o检测人的情绪chatgpt4.0会收费么GPT4ochatgpt加入会员多少费用