MySQL tips

What is the difference between TIMESTAMP and DATETIME types ?

All differences are written according to MySQL 5.7. The most important difference between DATETIME and TIMESTAMP types is the timezone storage. TIMESTAMP stores the values converted from current ti...

Continue Reading β†’

How to show a variable ?

MySQL is known for its possibility of storing and requesting the data. But it can also use the variables. To display one variable in MySQL, a simple SELECT suffices: mysql> SET @hello = "World !"; ...

Continue Reading β†’

How to export database (or its part) ?

Database export is very usefull in the situations when we want to restore database from some precised point in the past. To do that in command line, we can use mysqldump command. They're different sam...

Continue Reading β†’

How to import file's content into database ?

We can not only export database content but also import the content from one file containing SQL commands. To do that, we can use < after database connection command. Following command import dump....

Continue Reading β†’

How to show floats with 2 numbers after the decimal point ?

In some situations, we can wish to show floating numbers with fixed number of numbers after the decimal point. In this case, ROUND(field, decimal places) can be used. Take a look on given samples: ...

Continue Reading β†’