I need help with the queries I wrote and I don't understand what is wrong with them? Can someone help me correct them?

#11
SELECT BOOK_CODE, TITLE, PUBLISHER.PUBLISHER_CODE, PUBLISHER_NAME 
FROM BOOK, PUBLISHER 
WHERE PUBLISHER.PUBLISHER_CODE = BOOK.PUBLISHER_CODE 
ORDER BY PUBLISHER_NAME;
#12
SELECT BOOK_CODE, TITLE, PRICE 
FROM BOOK, PUBLISHER 
WHERE PUBLISHER_NAME = 'Plume' 
AND BOOK.PUBLISHER_CODE = PUBLISHER.PUBLISHER_CODE;
#13
SELECT BOOK_CODE, TITLE, PRICE 
FROM BOOK, PUBLISHER 
WHERE PUBLISHER_NAME = 'Plume' 
AND BOOK.PUBLISHER_CODE = PUBLISHER.PUBLISHER_CODE 
AND PRICE >= 14;
#14
SELECT TITLE, BOOK.BOOK_CODE, ON_HAND, BRANCH.BRANCH_NUM 
FROM BOOK, BRANCH, INVENTORY 
WHERE BRANCH.BRANCH_NUM = 4 
AND BOOK.BOOK_CODE = INVENTORY.BOOK_CODE 
AND INVENTORY.BRANCH_NUM = BRANCH.BRANCH_NUM;
#15
SELECT TITLE 
FROM BOOK, PUBLISHER 
WHERE TYPE = 'PSY' 
AND PUBLISHER_NAME = 'Jove Publications' 
AND BOOK.PUBLISHER_CODE = PUBLISHER.PUBLISHER_CODE ;
#16
SELECT TITLE, BOOK_CODE 
FROM BOOK 
WHERE BOOK_CODE 
IN (SELECT BOOK_CODE FROM WROTE WHERE AUTHOR_NUM =18);
#17
SELECT A.BOOK_CODE,  B.BOOK_CODE, A.PRICE FROM BOOK A, BOOK B WHERE A.PRICE=B.PRICE AND A.BOOK_CODE < B.BOOK_CODE ORDER BY A.BOOK_CODE, B.BOOK_CODE;
#18
SELECT BOOK.BOOK_CODE, TITLE FROM BOOK, WROTE, INVENTORY WHERE INVENTORY.BRANCH_NUM = 2 AND AUTHOR_NUM = 20 AND BOOK.BOOK_CODE = WROTE.BOOK_CODE AND INVENTORY.BOOK_CODE = BOOK.BOOK_CODE;
#19
SELECT A.BOOK_CODE, B.BOOK_CODE, A.PRICE FROM BOOK A, BOOK B WHERE A.PRICE=B.PRICE AND A.BOOK_CODE < B.BOOK_CODE ORDER BY A.BOOK_CODE, B.BOOK_CODE;
#20
SELECT TITLE, AUTHOR_LAST, ON_HAND FROM WROTE, BOOK, BRANCH, INVENTORY, AUTHOR WHERE BRANCH.BRANCH_NUM = 4 AND BOOK.BOOK_CODE = INVENTORY.BOOK_CODE AND BOOK.BOOK_CODE = WROTE.BOOK_CODE AND INVENTORY.BRANCH_NUM = BRANCH.BRANCH_NUM AND WROTE.AUTHOR_NUM = AUTHOR.AUTHOR_NUM;
#6
SELECT CUSTOMER_NUM, CUSTOMER_NAME
FROM CUSTOMER WHERE CUSTOMER.CUSTOMER_NUM
NOT IN (SELECT CUSTOMER_NUM FROM ORDERS WHERE ORDER_DATE = '2007-10-21');

Can someone help me correct my mistakes? the teachers compilers just say there was a syntax error in each of the queries i wrote.

Thanks

Member Avatar for diafol

It would help if you noted which ones were causing an issue. Have you used or die(mysqli_error()) or the mysql equivalent - whichever you're using to find the error yourself?

oh, each one of those were causing an issue because they had a syntax issue... i wrote about 30 queries for the assignment but those were the few that had syntax issues that i am not understanding.

whichever you're using to find the error yourself?

The teacher's compiler is indicating that those had errors.

on all of these it says that (in the error):
Table 'jstudent0.BOOK' doesn't exist

That says, I believe, that in the database jstudent0, the table BOOK doesn't exist.

Are you sure that's the table name? Is it BOOKS?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.