MySQL:- Select Statement:- Equal Sign and Testing for Equality

  Background Let us touch on the select statement and how we should take care when using it.   Use Select Statement SQL Output Output - Grid Explanation Set @number1 to 5 Set @number2 to 21 Set @answer1 to @number1 SQL:- select @answer1 = @number1 Returned:- null Set @answer2 to @number1 SQL:- select @answer2 := @number1 … Continue reading MySQL:- Select Statement:- Equal Sign and Testing for Equality

MySQL:- Variable – User-Defined Variables and Local Variables

Variables User-Defined Variables To declare user-defined variables, please prefix your variable name with @. User-defined variables are not explicitly defined. Please initialize variable by using set ( set @name='julia' ) or issue ( select @student = 'June Baker' ).   Sample Code   Local Variables Whereas, Local Variables can only be used in stored objects … Continue reading MySQL:- Variable – User-Defined Variables and Local Variables

MySQL – Temporary Table & Common Table Expression ( CTE ) – Error – “Can’t reopen table” ( Error 1137 )

Background There is a small error that one can run into when using Temporary Tables and Common Table Expression ( CTE ). Error Error - Can't reopen table Error Image Error Text Scenario Common Table Expression SQL Result   Temporary Table & Common Table Expression Query:- Successful SQL Result Query - Failed SQL Output Output … Continue reading MySQL – Temporary Table & Common Table Expression ( CTE ) – Error – “Can’t reopen table” ( Error 1137 )