Database data Check Weight

Source: Internet
Author: User

rowID is the data stored in the database, automatically the encoding for that data, each data has a different encoding, we can quickly determine a column based on rowID , and then manipulate it.

This is the database to check the weight, and delete all duplicate data, only one, here I am based on the ID of this column to check the weight, multi-column check the method is similar.

Delete from TB where (ID) in
(select Name from TB GROUP by Name has count (ID) >1)
and rowID not in (the Select min (rowid) from the TB group by Name has count (id) >1);
Commit

Data from different regions are queried, and the same area data is placed together, from top to bottom, and sequentially on a single table.

A Union all B joins two tables, all of which are table A, the bottom is all table B, and the data for the two tables are all displayed, whether or not they are duplicated.

A union B joins two tables, similar to union all, but if there are duplicate data in two tables, the duplicate data is deleted, only one is left, and the sort is scrambled, not all above is table A, and below is table B.

SELECT * from TB t where diqu= ' Chaoyang ' UNION ALL SELECT * from TB t where diqu= ' open ' union all
SELECT * from TB t where diqu= ' nan ' union ALL SELECT * from TB t where diqu= ' green garden '
UNION ALL SELECT * from TB t where diqu= ' er ' union ALL SELECT * from TB t where diqu= ' high '
UNION ALL SELECT * from TB t where diqu= ' auto City ' UNION ALL SELECT * from TB t where diqu= ' Dehui '
UNION ALL SELECT * from TB t where diqu= ' Kuancheng ' UNION ALL SELECT * from TB t where diqu= ' net month '
UNION ALL SELECT * from TB t WHERE diqu= ' Elm '

Database data Check Weight

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.