Delete duplicate MySQL distinct

Date:

2018-07-11 22:00:20

Views:

1190

Rating:

1Like 0Dislike

Share:

Table of contents:

If semantic organization of the information embodied in reality, the scope of design MySQL distinct keyword would have instantly self-destructed. Modern database built in the framework of relational data relationships, so the task of deleting duplicate records are relevant.

MySQL distinct

The Appearance of identical strings, as a rule, is not a problem that cannot be solved, but to avoid duplication of the contents of table fields is practically impossible in many cases.

Organization of the database

It is believed that “correct” the database has a unique table, and each of them contains a unique field. Allows the presence of identical content in the fields of different tables only when they are key and it is the logical link data.

For Example, a diagram of the staffing will come out of table of data about employees for a specific field. The staffing table only contains what it refers to in the context of a particular company and a list of employees only contains personal data of staff.

With this option MySQL distinct will work on the query to both tables that links staffing with employees.

The uniqueness of the tables and fields

In the interaction table the staffing table and the list of employees for each row of the first table has a special place in the second. The second table can contain the same surnames, names, patronymics of people, addresses of living in the city can also contain identical street. Numbers of houses and apartments may not matter that much (they don't take up much space).

Recommended

How to get out of

How to get out of "Skype" on the "Android" and not only

How to get out of "Skype" "Android"? This question bothers many users. The thing is that the messenger is not so difficult. But there are features that are only for mobile versions. To log out of Skype in this case more difficult than it seems. But i...

Kingo ROOT: how to use the program to gain administrative rights on Android

Kingo ROOT: how to use the program to gain administrative rights on Android

The Gadgets on the platform Android regained the lion's share of the market. Developers are continually perfecting the OS, trying to fit the needs of the users, but from year to year admit palpable mistake: forbid the owner to "stuffing" of his gadge...

How to get from Stormwind to Tanaris: practical tips

How to get from Stormwind to Tanaris: practical tips

World of Warcraft is an iconic MMORPG, uniting millions of players around the world. There are many locations and puzzles, secret trails and larger, but rather dangerous paths. Sooner or later, every player chose the side of the Alliance, we have to ...

Ideally, all of the same words placed in different tables and they correspond to a unique key. For example, a list of all the streets, names, names, patronymics. In the employee table the primary schema merge in the correct version of the submission, and to table the staffing table is connected not with a list of employees and the query for it, and those that are associated with it.

mysql query select distinct

The more classified the information, the more important to use the MySQL distinct keyword. For the proper organization of data has “pay” - when joining tables total number of rows from the sample increases in proportion to the number of rows in each table. This is an abstract example, usually the developer does not detail information to such an extent. Use MySQL distinct solves this problem: it will only select the desired entry.

Can stand the task of parsing the paragraphs into sentences, sentences into phrases, and phrases into words. In this case, without a dictionary is not enough, and it will have to make a dictionary conjugations, endings and other elements of the language syntax.

Example of fetching a MySQL query "select distinct ..."

The table has records in which the four seasons and two state of entry: active and passive. Examples fetch:

  • All records;
  • Only unique
  • Unique within the conditions.

They can be like indicated on the image in the article.

Author's example is not a picture

The functionality of the operator fetching only unique records will satisfy any data structures. You can use a query in the query, group and sort data before selecting.

However, it is always preferable to simplify the work with the database. Using MySQL distinct on a single field is always preferable than working on several.

mysql distinct on one field

It is Particularly important to formulate queries that combine multiple tables. Any entity data in the relational databases, before you start to function in the where clause and the join leads to large amounts of data. Orientation in them requires care and patience from the developer.


Article in other languages:

AR: https://tostpost.com/ar/computers/7710-delete-duplicate-mysql-distinct.html

BE: https://tostpost.com/be/kamputary/13782-vydalenne-dubl-kata-mysql-distinct.html

DE: https://tostpost.com/de/computer/13787-entfernen-sie-doppelte-mysql-distinct.html

ES: https://tostpost.com/es/los-ordenadores/13795-la-eliminaci-n-de-duplicados-de-mysql-distinct.html

HI: https://tostpost.com/hi/computers/7717-mysql.html

JA: https://tostpost.com/ja/computers/7713-mysql.html

KK: https://tostpost.com/kk/komp-yuterler/13785-zhoyu-teln-s-alaryn-mysql-distinct.html

PL: https://tostpost.com/pl/komputery/13780-usuwanie-duplikat-w-mysql-distinct.html

PT: https://tostpost.com/pt/computadores/13772-a-elimina-o-de-duplica-o-mysql-distinct.html

TR: https://tostpost.com/tr/bilgisayarlar/13788-yinelenen-kald-rma-mysql-d-st-nct.html

UK: https://tostpost.com/uk/komp-yuteri/13784-vidalennya-dubl-kat-v-mysql-distinct.html

ZH: https://tostpost.com/zh/computers/8412-mysql.html






Alin Trodden - author of the article, editor
"Hi, I'm Alin Trodden. I write texts, read books, and look for impressions. And I'm not bad at telling you about it. I am always happy to participate in interesting projects."

Comments (0)

This article has no comment, be the first!

Add comment

Related News

Alien: Isolation. Review and walkthrough

Alien: Isolation. Review and walkthrough

a review of the game Alien Isolation from developer the Creative Assembly and includes a brief description of the advantages and disadvantages of the game. The project in this genre and this universe became a sensation. First, due...

Anysend: what is this program and how to remove it in its entirety?

Anysend: what is this program and how to remove it in its entirety?

Quite often, many users find their computers the presence of a strange applet called Anysend. What is this application, many do not really know. Meanwhile, it is worth to say that you need to remove it immediately because it is an...

Like in Minecraft to make a trampoline with the mod and without?

Like in Minecraft to make a trampoline with the mod and without?

Jumping is a weak point your character in Minecraft. To realize more or less plausible jump, you will have to get a horse, since it can even overcome obstacles. But your character is very weak in this discipline, so sometimes you ...

How to make table of contents in Word?

How to make table of contents in Word?

Every job always begins with the development of the action plan and ends with the verification of compliance with this plan. In particular, this rule applies to a term paper, thesis, essay. Work on essay starts with creating a blu...

How to disable ads in the Internet, making surfing the net easier?

How to disable ads in the Internet, making surfing the net easier?

Advertising-the motor trade, as well as a curse for Internet users. If you have developed a familiarity with the Global Web of at least ten years ago, remember pristine sites, and advertising banners, among which there are two or ...

How to flash PSP: three solutions

How to flash PSP: three solutions

the Firmware is the basic software included in the operating system of the device. In this case we are talking about gaming consoles PSP. However, the term “firmware” applied also to other technical devices, e.g. mobil...