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 )

MySQL – Workbench – Error – “You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column.” ( Error Code: 1175 )

Background Using MySQL's Workbench to run a simple query. But, ran into an easy to remediate error. Query SQL Error Error Image Error Text Remediate Outline SQL Use SQL_SAFE_UPDATE Set SQL_SAFE_UPDATE off       SQL Statements SET SQL_SAFE_UPDATES on GUI SQL Workbench SQL Use SQL_SAFE_UPDATE Outline Use SQL_SAFE_UPDATE Set SQL_SAFE_UPDATE off       … Continue reading MySQL – Workbench – Error – “You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column.” ( Error Code: 1175 )

MySQL – Insert/Ignore

Background In our last post, we touched on a duplicate key error. Here is another quick workaround around the same issue. Lineage MySQL – Insert/On Duplicate Key Update Link Error Error Message Text Image Entity Diagram Table Definition SQL Code Offending Code SQL Clean up Code Outline Add Ignore clause to insert statement SQL Output … Continue reading MySQL – Insert/Ignore