Below is an example how to insert multiple values/rows into a table using a single insert statement shortcut. Versus individually listing out each insert statement
We’ll be using the MySQL built-in function char_length to demonstrate how to filter and sort based on a size of a columns width in characters.
In a single statement you can copy the structure and data from one table in MySQL and populate the results of a query into the
Unlike SQL Server, String concatenation works using a function. It’s a simple function that you pass comma separated values into in the order you want
In this case we want to get the average of values but we also want to ignore certain values, say if when the deviceType column
Using the substring function, this example below will select the leftmost 6 characters from a string field named “field_name” in the table tbl_stuff with mysql.
After you run a query on MySQL server you may get warning messages. To see the complete warnings you simply run the command show warnings.
The built-in function coalesce in MySQL is great for outer joins where the return or expected answer can be null. Coalesce can be used anytime
In the MySQL sql language, the insert modifier ignore can sometimes come in handy if you’re wanting to run the query but not worry about
This below would parse the string, in the specified format into a valid date time object. STR_TO_DATE only works when the date mask is valid