May 2020
Beginner
564 pages
14h 9m
English
In order to use a variable in a SQL statement, you need to place the variable name into the query, as shown in the following example:
USE lahmansbaseballdb;SET @varname := 'ALB01';SELECT * FROM parks_copyWHERE parkkey = @varname;
The preceding query produces the following results:
This was a simple example that shows how to use a variable – they can be quite powerful.
Read now
Unlock full access