Quantcast
Channel: mysql – I want to be free
Browsing all 13 articles
Browse latest View live

Bulk SQL loading

If you want to load a list of SQL files into your database on Windows, you can create a .cmd file with such content and run it. Place it in the same folder where your .sql files are. @echo off SET...

View Article



MySQL Proxy

At times it’s necessary to know which queries the server runs right now. Of course, you can try this statement: SHOW PROCESSLIST but if you need a more poweful tool, try MySQL Proxy. Although it’s...

View Article

Image may be NSFW.
Clik here to view.

Delete Your Code #7: Right encoding

You might be surprised, but a right choise of the project text encoding can affect the project file size and amount of bugs. To avoid bugs of wrong presentation of text on your page, make sure that all...

View Article

Delete Your Code #8: Use the default values

Default values — how trivial this hint might seem… Although, simple things make life easier. If you have a huge amount of SQL updates in your system, having correct default values helps to build...

View Article

Image may be NSFW.
Clik here to view.

Convert latin1 to utf8

If you import unicode text into latin1 database column, the symbols would be screwed up — russian symbols become a shit like “залоговый депозит”. To convert such quickly (as a test) you...

View Article


Preferrable sorting in MySQL

At times, some records in a recordset are more important than others — e.g. a featured product in a products list. In such a case you can make 2 requests to get the featured item first, then to load...

View Article

SQL function to count distance between two points

Useful function. DELIMITER // DROP FUNCTION IF EXISTS DISTANCE; // CREATE FUNCTION DISTANCE( lat1 DOUBLE, lon1 DOUBLE, lat2 DOUBLE, lon2 DOUBLE ) RETURNS DOUBLE NO SQL DETERMINISTIC COMMENT 'counts...

View Article

Reverse geocoding in your app

Reverse geocoding is a process of getting toponym name (city name) by its coordinates. To make this, you can use a remote service like I have already described, or implement it yourself. To do so you...

View Article


Image may be NSFW.
Clik here to view.

GIS: parent-child auto-detection. Part I. Data.

In our project, we had to solve a task of definition of administrative districts nesting. The task was to organize the administrative centers in a clear hierarchy like a Russian doll (nested...

View Article


Database choice

If you consider a database engine for the new project between MySQL and Postgres, choose Postgres. Reasons are simple. 1. Postgres has stricter datatypes. If a field is integer, you cannot assign a...

View Article

Image may be NSFW.
Clik here to view.

Major problems with geo in MySQL

Many development projects are started with MySQL on board — it’s free, stable and scalable. At some point your project might need Geo features (a.k.a. “spatial calculations“): a great example would be...

View Article

MySQL random function

MySQL RAND() function returns values between 0 and 1. At times you need a random value between A and B, then you can use this function: DELIMITER // DROP FUNCTION IF EXISTS RANDOM;// CREATE FUNCTION...

View Article

MySQL stored procedures debugging

It seems there are no built-in ways to debug user-defined functions or procedures in MySQL. So if the function behaves bad, it’s hard to find out why. Here is what I do in order to trace a function....

View Article

Browsing all 13 articles
Browse latest View live




Latest Images