Request user to enter variable in MySQL

At school, I believe that I work with Oracle SQL Developer when writing SQL. And in this I can type:

SELECT Book_Title, Auth_ID
FROM book
WHERE Auth_ID = '&Enter ID';

Then a small message box will appear in which the user can enter an identification number to view all the books written by the author with this identification number.

I want to know if there is a way to do this in MySQL. I looked, and the closest I can find is to set a variable in front of my hand, which is not quite what I'm looking for:

SET @EnterID := 2;
select Book_Title, Auth_ID
from book
where Auth_ID = @EnterID;

The above MySQL statement returns all books with author ID 2, but only because I installed it earlier. I want the user to be able to enter a variable.

Thank.

+4
source share
2 answers

char ':',

:

select * 
from YOUR_TABLE 
where YOUR_COLUMN = :your_var
0

mysql SQL-. SQL - , .

: MySQL ?

-2

All Articles