sql数据库图书管理系统
时间: 2023-12-22 13:04:25 浏览: 106
<<引用[1]:CREATE TABLE books (
book_id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(100) NOT NULL,
author VARCHAR(100) NOT NULL,
genre VARCHAR(50),
publication_date DATE,
available BOOLEAN
);
引用:INSERT INTO books (title, author, genre, publication_date, available) VALUES ('The Great Gatsby', 'F. Scott Fitzgerald', 'Classic', '1925-04-10', true);
引用:SELECT * FROM books;
引用:UPDATE books SET available = false WHERE title = 'The Great Gatsby';
引用:DELETE FROM books WHERE title = 'The Great Gatsby';>>
以下是SQL数据库图书管理系统的一些操作示例:
1. 创建图书表:
```sql
CREATE TABLE books (
book_id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(100) NOT NULL,
author VARCHAR(100) NOT NULL,
genre VARCHAR(50),
publication_date DATE,
available BOOLEAN
);
```
2. 插入图书信息:
```sql
INSERT INTO books (title, author, genre, publication_date, available) VALUES ('The Great Gatsby', 'F. Scott Fitzgerald', 'Classic', '1925-04-10', true);
```
3. 查询图书信息:
```sql
SELECT * FROM books;
```
4. 更新图书信息:
```sql
UPDATE books SET available = false WHERE title = 'The Great Gatsby';
```
5. 删除图书信息:
```sql
DELETE FROM books WHERE title = 'The Great Gatsby';
```
阅读全文