MySQL usage classic (1 )---- duplication of data to judge

2010-06-27  来源:本站原创  分类:Database  人气:174 

I work in practical application. In the acquisition of data of the time, asked after data collection, can not be repeated. Hand in hand with Duoge instances of the same time Yunzhuan, Bao Zheng's continuity of data collection. So what conclusion Liao, made Le Ruxia of Xiao Shi Yan . Core code:
Table structure: only three field
id, name, password

CREATE TABLE `tt` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  `password` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

sql statement

insert into tt(name,password) select 'phl','123' from dual where not exists(select * from tt where name='phl' and password='123')

This is the meaning of SQL statements, if the inserted data name = 'phl', password = '123 'does not exist, then the implementation of the insert;

相关文章
  • MySQL usage classic (1 )---- duplication of data to judge 2010-06-27

    I work in practical application. In the acquisition of data of the time, asked after data collection, can not be repeated. Hand in hand with Duoge instances of the same time Yunzhuan, Bao Zheng's continuity of data collection. So what conclusion Liao

  • MySQL usage classic (1 )---- data duplication check (change) 2010-08-10

    I work in practical application. In the acquisition of data, when asked after data collection, can not be repeated. But also requires running multiple instances of the same time, ensure the continuity of data collection. So summed up what, made the f

  • MySQL usage classic (1) 2010-06-27

    I work in practical application. In the acquisition of data of the time, asked after data collection, can not be repeated. Hand in hand with Duoge instances of the same time Yunzhuan, Bao Zheng's continuity of data collection. So what conclusion Liao

  • MySQL usage classic (4 )---- substantial increase in performance programs, the partition table 2010-08-03

    Here I work on the problems encountered in time to simulate what happens in all of us are introduced. Work is still yes massive data to appear in the case. Each year, is likely to be hundreds of millions of records. And the data of time-relatively st

  • MYSQL database on the duplication of data processing 2010-11-19

    If the table to delete duplicate records (keep a duplicate record), can be removed by the following methods select distinct * into # Tmp from tableName drop table tableName select * into tableName from # Tmp drop table # Tmp Choose all that is the on

  • MySQL database usage classic 2011-02-25

    Classic MySQL database usage: http://phl.iteye.com/category/110163

  • No duplication of data into MySQL 2011-01-06

    Development operations in a many to many association table to insert the record, in fact one and the realization of a number of functions in I is not different is the number of duplicate records can seem awkward, after all, is not good, so pondering

  • Mysql Export table structure and table data usage mysqldump 2010-11-02

    The specific use of the command line as follows: mysqldump-u username-p password-d database name of the script name watches; 1, export the database table structure for the dbname (where username is root, password is dbpasswd, generated script called

  • How to set the mysql database can be case-sensitive query data (not to set a single field) 2010-04-11

    http://wenwen.soso.com/z/q112133816.htm How to set the mysql database can query data, such as case-sensitive select * from abc whre and select * from abc whre check out the results are different ways to set a single field would not have said, want is

  • Flex usage [Classic] ---- switch 2010-04-23

    / / Get screen resolution var x: Number = Capabilities.screenResolutionX; var y: Number = Capabilities.screenResolutionY; Alert.show ("x =" + x + "y =" + y); The second method Alert.show (stage.fullScreenWidth +"=="+ stage.fu

  • Mysql copy the table structure. Sheet data ERROR 1064 (42000): 2010-06-03

    Mysql replication table structures, create table order like orderdetails; Have error: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order lik

  • MYSQL in multi-table delete to delete data 2010-07-08

    DELETE to delete multiple tables of data, how to delete multiple related table data? Done in-depth explanation here: 1, delete from t1 where conditions 2, delete t1 from t1 where conditions 3, delete t1 from t1, t2 where conditions 4, delete t1, t2 f

  • MySQL uses log files to recover data 2010-09-27

    MySQL binary log file may not make data backup of the database of last resort bar. Met today, yesterday, just in the project have not been able to do regular backups of data on a problem. Only the use of log files (fortunately my logging function to

  • oracle.mysql.sqlserver out of 10 random data 2011-03-02

    - Oracle out of 10 random data SELECT * FROM ( SELECT * FROM acc_nbr ORDER BY trunc (dbms_random.value (1,11)) ) WHERE ROWNUM <= 10 - Dbms_random.value (); is to generate a random number or string package - 1. There is no argument will return a numbe

  • MySQL command to export and import data using 2010-10-22

    Command line to export the database: 1, into the mysql directory under the bin folder: cd MySQL bin folder in the directory as I entered the command line: cd C: \ Program Files \ MySQL \ MySQL Server 4.1 \ bin 2, export the database: mysqldump-u user

  • The if conditional statement mysql usage 2010-10-19

    · IF (expr1, expr2, expr3) If expr1 is TRUE (expr1 <> 0 and expr1 <> NULL), then IF () returns a value of expr2; otherwise the return value was expr3. IF () return value is a number or string value, depending on the context it may be. mysql>

  • mysql and export part of the data 2011-01-11

    First, enter the mysql bin directory under the installation path. window platform mysqldump-ugjcx-ppassword gjcx mms_send "- w = 'where mms_at_time> 2011-1-1 00:00:00'"> / home / mas / mms_send.sql linux platform . / Mysqldump-ugjcx-ppassw

  • mysql insert a SQL a large-capacity data 2011-05-05

    In this SQL text: INSERT INTO table_name (column1, column2, column3,...) VALUES (value1, value2, value3,...),VALUES (value1, value2, value3,...),... Execution, mysql error, this time in the my.ini mysql last line add max_allowed_packet=100m

  • decode function usage details - decode the result data type problem 2011-05-12

    Problem Description: When to use decode function in sql data processing, decode the result data type is how is it? * When using the decode function, the resulting data are first transformed into the type of data For example: decode (date; 0 null, 1 )

  • Time-to-many with DetachedCriteria to avoid duplication of data 2010-04-26

    1. DetachedCriteria criteria = DetachedCriteria.forClass () / / the parent object 2. All the query to write in. 3. DetachedCriteria rootCriteria = DetachedCriteria.forClass () / / the parent object 4. Criteria.setProjection (Projections.distinct (Pro