Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat can I expect from this query using NOT IN?
    text
    copied!<p>What is the result if you try to run the following query? Assume for this query that all books have a value for publ_id and no publ_id is 90 </p> <pre><code>Select * From a_bkinfo.books Where publ_id not in (90, null); </code></pre> <p>I ran the query and received no rows, but I thought it this would return rows where the publ_id is not 90. I am confused. What am I not seeing? </p> <pre><code>Table: -- create publishers create table a_bkinfo.publishers ( publ_id integer not null , publ_name varchar(25) not null , constraint bk_publishers_pk primary key(publ_id) , constraint publ_id_range check (publ_id &gt;1000) )engine = INNODB; Inserts: -- publishers Insert into a_bkinfo.publishers values (9000, 'Microsoft Press') ; Insert into a_bkinfo.publishers values (9456, 'New Directions') ; Insert into a_bkinfo.publishers values (9102, 'Alfred A. Knopf') ; Insert into a_bkinfo.publishers values (9325, 'Addison Wesley') ; Insert into a_bkinfo.publishers values (9745, 'Morgan Kaufmann') ; Insert into a_bkinfo.publishers values (9521, 'Benjamin/Cummings') ; Insert into a_bkinfo.publishers values (9822, 'O''Reilly') ; Insert into a_bkinfo.publishers values (9030, 'McGraw Hill') ; Insert into a_bkinfo.publishers values (9444, 'APress') ; Insert into a_bkinfo.publishers values (9528, 'Manning'); Insert into a_bkinfo.publishers values (9020, 'Princeton Univer Press') ; Insert into a_bkinfo.publishers values (9021, 'Yale University Press') ; Insert into a_bkinfo.publishers values (9022, 'Havard University Press') ; Insert into a_bkinfo.publishers values (9507, 'J.Q. Vanderbildt'); Insert into a_bkinfo.publishers values (9664, 'WROX') ; Insert into a_bkinfo.publishers values (9825, 'MySQL Press') ; Insert into a_bkinfo.publishers values (9623, 'Prentice Hall') ; Insert into a_bkinfo.publishers values (9725, 'Springer') ; Insert into a_bkinfo.publishers values (9561, 'Houghton Mifflin'); Insert into a_bkinfo.publishers values (9902, 'W.W. Norton ') ; Insert into a_bkinfo.publishers values (9023, 'Holt Paperbacks') ; Insert into a_bkinfo.publishers values (9024, 'Univ of California Press') ; Insert into a_bkinfo.publishers values (9776, 'Simon and Schuster') ; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload