Tag Archives | MySQL

MySQL Store Procedure to Loop with Table Cursor and Update with UUID()

This is a sample MySQL store procedure where I loop in all rows in a table and then I update each row with a UUID().

Read full story Comments { 0 }

Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation ‘=’

Searching for answers to an identical “Illegal mix of collations” error with conflicts between utf8_unicode_ci and utf8_general_ci. I found that some columns in the database were not specifically collated utf8_unicode_ci. It seems mysql implicitly collated these columns utf8_general_ci. Specifically, running a ‘SHOW CREATE TABLE table1’ query outputted something like the following: | table1 | CREATE […]

Read full story Comments { 0 }

Create View in MySQL

To create a new view in MySQL, you use the CREATE VIEW statement. The syntax of creating a view in MySQL is as follows: CREATE    [ALGORITHM = {MERGE  | TEMPTABLE | UNDEFINED}] VIEW[database_name].[view_name] AS [SELECT  statement] Sample:

Read full story Comments { 0 }

MySQL DELETE JOIN

This quick reference introduces you a more flexible way to delete data from multiple tables by using INNER JOIN or LEFT JOIN clause in the DELETE statement. MySQL DELETE JOIN with INNER JOIN Syntax MySQL DELETE JOIN with INNER JOIN Example MySQL DELETE JOIN with LEFT JOIN Example

Read full story Comments { 0 }

MySQL TRIM() function

MySQL TRIM() function returns a string after removing all prefixes or suffixes from the given string. Syntax TRIM([{BOTH | LEADING | TRAILING} [remstr] FROM ] str) Arguments Name Description BOTH Indicates that prefixes from both left and right are to be removed. LEADING Indicates that only leading prefixes are to be removed. TRAILING Indicates that […]

Read full story Comments { 0 }

Trigger That Will Remove All Blanks Spaces From a Field

If you are importing data into a table and some of the data like a customer fields has blank spaces on it and you want to get rid of then a trigger for Insert event may a quick solution. Here is a request: ‚Äú Is it possible to create a trigger that will remove all […]

Read full story Comments { 0 }

SQL SELECT TOP Clause

The SQL SELECT TOP Clause The SELECT TOP clause is used to specify the number of records to return. The SELECT TOP clause can be very useful on large tables with thousands of records. Returning a large number of records can impact on performance. Note:¬†Not all database systems support the SELECT TOP clause. SQL Server […]

Read full story Comments { 0 }

Finding the location of a string in a string with MySQL

Finding the location of a string in a string with MySQL

Read full story Comments { 0 }