Read data from selected columns with a specific ID

Read data from selected columns with a specific ID

SELECT title, author, price
FROM books
WHERE bookid = 4

To select multiple bookids, you can use the IN clause in your SQL query. Here’s how you can modify your code to select multiple bookids:

SELECT title, author, price
FROM books
WHERE bookid IN (4, 5, 7) — Replace 4, 5, 7 with the IDs you want to select

This will allow you to retrieve data for books with bookid 4, 5, and 7. You can include as many bookids as you need within the parentheses, separated by commas.

Leave a Reply

Your email address will not be published. Required fields are marked *