I'll say right away that this article is not mine, but I really liked it, and to avoid having to search for it later, I decided to post it here. Fortunately, the author does not prohibit this on his website. Thank you very much to him for that. Here is the original: http://blog.peter.am/index.php/2010/11/3…
This article will cover the main ways to perform type casting in MySQL. It should be noted that in most cases, type casting in MySQL will work automatically, for example:
Window functions are functions that calculate a scalar value based on a window (set of records). This value is determined using the OVER instruction. Example: select regioncode, aolevel, offname, row_number() over(partit…
MySQL database supports several different types of tables, each with its own unique features and limitations. I will start my description with the "native" type of tables for MySQL, MyISAM. If the type of table is not specified in the create table operator, it will be assigned to MyISAM. Each MyISAM table is stored on disk in three files (in the subdirectory of the mysql/data catalog), the names of which match the name of the table, and the extension can take one of the following values: .frm - the structure of the table, this file contains information about the names and types of columns and indexes; .MYD - in this file, the data of the table is stored; .MYI - in this file, the indexes of the table are stored. Tables of the MyISAM type have several features: 1. Data is stored in a cross-platform format, which allows for the transfer of databases from one server to another by direct copying of files, bypassing intermediate forms. 2. The maximum number of indexes is 64 (from version 4.1.2). Each index can be a maximum of 16 columns. 3. From MySQL 4.1, a specific encoding can be set for each text column. 4. Indexing of text columns, including variable-length columns, is allowed. 5. Full-text search is supported. 6. Tables have a special flag indicating the correctness of closing the table. If the server was stopped abnormally, when loading, the flags of the closed tables will signal the possible damage to the tables and the server will attempt to automatically check and restore them.
Recently came across a very useful resource for all developers working with databases, called Connection Strings. The resource is a collection of various connection strings to different databases using various providers and technologies. Very useful resource. Here is the link: <a href="[[B0]]" target="_blank" rel="noopener external">[[B1]]</a>. The resource is in English, but I assume it's not a problem for those who need it.
The following problem arose, in the case of the absence of data in the table, the result of the maximum value query in the field will output a value of null, of course, you can handle the result in the program, but it is significantly easier to assign this functionality to a script.
The simplest way to store passwords in a database is to place them in a user table in the open field, for example, in a field with a VARCHAR type. But with such an approach, in the event that the database falls into the hands of an attacker, all passwords will be 100% known to him...
Adding Records to a Table Ignoring IDENTITY: -- Enable SET IDENTITY_INSERT tableA ON -- You must specify the full list of columns for INSERT: INSERT Into tableA ([id], [c2], [c3], [c4], [c5] ) SELECT [id], [c2], [c3], [c4], [c5] FROM tableB...
Команды манипулирования данными SELECT , UPDATE , DELETE работают сразу с группами строк. Эти группы, вплоть до отдельных строк, можно выбрать с помощью опции WHERE. А если надо перебрать строки некоторой таблицы последовательно, одну за др…
From the archive I will tell you about one small nuance that will help save time and nerves. This feature was noticed by me only in MySQL (manifested both in 5 and currently in the test 6th). It is about the need for a special naming of procedures for proper recovery of the database from the MySQL archive (dump).