Interview question: write one script that inserts multiple rows in a single SQL query and runs unchanged in SQL Server, MySQL and PostgreSQL. Here is my answer.
MySQL – LEAST and GREATEST Comparison Operators
Comparing values across many columns is a common chore. Here is how the MySQL LEAST and GREATEST comparison operators find the smallest and largest value.
MySQL – FOUND_ROWS() Function for Total Number of Rows Affected
In SQL Server you get the number of rows affected with @@ROWCOUNT. In MySQL, you can find the total number of rows with FOUND_ROWS().
MySQL – Different Methods to Know Current User
Why check the current user in MySQL? For audits, permissions and custom logic. Here are the methods, from user() and current_user() to mysql.user.
MySQL – How to Drop Table If Exists in Database?
SQL Server 2016 added DROP IF EXISTS, but MySQL has had it for years. Here is how to drop table if exists in a MySQL database.
MySQL – ELT() and FILED() Functions to Extract Index Position From List
MySQL’s ELT() returns the value at a given index position in a list, and FIELD() does the reverse. Here is how both functions work, with simple examples.
MySQL – How to Generate Random Number
MySQL’s UUID() function returns a random 36 character value. Here is how to generate random number strings and passwords of any length from it.






