【发布时间】:2022-01-10 10:00:06
【问题描述】:
您好,我正在为我的软件工程课做 psql 数据库的作业,我必须做的一个问题是“查找所有包含 Python 的书籍”,所以我尝试使用 WHERE 语法,但它会给出我 0 行没有标题中包含 Python 一词的书籍,但显然书籍表中有任何人可以帮我解决这个问题吗?
booktown=# SELECT books.title FROM books WHERE title NOT IN ('Python');
title
-----------------------------
The Shining
Dune
2001: A Space Odyssey
The Cat in the Hat
Bartholomew and the Oobleck
Franklin in the Dark
Goodnight Moon
Little Women
The Velveteen Rabbit
Dynamic Anatomy
The Tell-Tale Heart
Programming Python
Learning Python
Perl Cookbook
Practical PostgreSQL
(15 rows)
booktown=# SELECT books.title FROM books WHERE title IN ('Python');
title
-------
(0 rows)
booktown=# SELECT books.title FROM books WHERE title LIKE 'Python';
title
-------
(0 rows)
booktown=# SELECT books.title FROM books WHERE title LIKE 'Python';
【问题讨论】:
-
like '%Pyhton%'postgresql.org/docs/current/…
标签: sql postgresql sql-like