Types of MySQL Variables - Local Variables
Types of MySQL Variables - Local Variables
scope
the region of a computer program where a phenomenon, such as a
variable, is considered valid
Types of MySQL Variables – Local Variables
scope
the region of a computer program where a phenomenon, such as a
variable, is considered valid
Types of MySQL Variables – Local Variables
scope
the region of a computer program where a phenomenon, such as a
variable, is considered valid
Types of MySQL Variables – Local Variables
scope
the region of a computer program where a phenomenon, such as a
variable, is considered valid
≠
Types of MySQL Variables – Local Variables
scope
the region of a computer program where a phenomenon, such as a
variable, is considered valid
≠
Types of MySQL Variables – Local Variables
scope =
the region of a computer program where a phenomenon, such as a
variable, is considered valid
≠
Types of MySQL Variables – Local Variables
scope = visibility
the region of a computer program where a phenomenon, such as a
variable, is considered valid
≠
Types of MySQL Variables – Local Variables
MySQL Variables
Types of MySQL Variables – Local Variables
MySQL Variables
Types of MySQL Variables – Local Variables
MySQL Variables
local
Types of MySQL Variables – Local Variables
MySQL Variables
local
Types of MySQL Variables – Local Variables
MySQL Variables
local
session
Types of MySQL Variables – Local Variables
MySQL Variables
local
session
Types of MySQL Variables – Local Variables
MySQL Variables
local global
session
Types of MySQL Variables – Local Variables
MySQL Variables
local global
session
Types of MySQL Variables – Local Variables
MySQL Variables
local global
session
local variable
a variable that is visible only in the BEGIN – END block in which it was
created
Types of MySQL Variables – Local Variables
DECLARE is a keyword that can be used when creating local variables only
session
a series of information exchange interactions, or a dialogue, between a
computer and a user
Session Variables
session
a series of information exchange interactions, or a dialogue, between a
computer and a user
Step 1
set up a
connection
Step 1
Session Variables
a session begins at a certain point in time and terminates at another,
later point
Step 1
set up a
connection
Session Variables
a session begins at a certain point in time and terminates at another,
later point
Step 1
set up a
connection
Step 2
Session Variables
a session begins at a certain point in time and terminates at another,
later point
Step 1
set up a
connection
Session Variables
a session begins at a certain point in time and terminates at another,
later point
Step 1 Step 2
set up a establish a
connection connection
Session Variables
a session begins at a certain point in time and terminates at another,
later point
Step 1 Step 2
set up a establish a
connection connection
Session Variables
a session begins at a certain point in time and terminates at another,
later point
Step 1 Step 2
session
Step 1 Step 2
session
Step 1 Step 2
session variable
a variable that exists only for the session in which you are operating
Session Variables
session variable
a variable that exists only for the session in which you are operating
session variable
a variable that exists only for the session in which you are operating
= 100
Session Variables
“Var”
“Var”
global variables
“Var” “Var”
“Var” “Var”
“Var” “Var”
“Var”
“Var” “Var”
Global Variables
.max_connections()
Global Variables
you cannot set just any variable as global
- a specific group of pre-defined variables in MySQL is suitable for
this job. They are called system variables
.max_connections()
.max_join_size()
Global Variables
you cannot set just any variable as global
- a specific group of pre-defined variables in MySQL is suitable for
this job. They are called system variables
.max_join_size()
Global Variables
you cannot set just any variable as global
- a specific group of pre-defined variables in MySQL is suitable for
this job. They are called system variables
user-defined
User-Defined vs System Variables
variables in MySQL can be characterized according to the way they have
been created
user-defined
system
User-Defined vs System Variables
variables in MySQL can be characterized according to the way they have
been created
system
User-Defined vs System Variables
variables in MySQL can be characterized according to the way they have
been created
user-defined
system
user-defined
system
user-defined
system
user-defined
system
user-defined
system
user-defined
system
user-defined
system
user-defined *
system *
user-defined *
system *
user-defined *
system *
- the larger a database is, the slower the process of finding the record
or records you need
MySQL Indexes
we can use an index that will increase the speed of searches related to
a table
MySQL Indexes
we can use an index that will increase the speed of searches related to
a table
Condition #1 Output #2
Output #1
Condition #1 Output #2
COALESCE()
Output #1
Condition #1 Output #2
COALESCE()
IFNULL()
Output #1
Condition #1 Output #2
COALESCE()
IFNULL()
SELECT
column_name(s)
CASE
WHEN condition_1 THEN result_1
WHEN condition_2 THEN result_2
…
ELSE
END AS
FROM
table_name;
THE CASE STATEMENT
SELECT
column_name(s)
CASE condition_field
WHEN condition_field_value_1 THEN result_1
WHEN condition_field_value_2 THEN result_2
…
ELSE
END AS
FROM
table_name;