Replace more than one column : Replace « Function « SQL / MySQL






Replace more than one column

      
mysql>
mysql>
mysql>
mysql> CREATE   TABLE TEAMS
    ->         (TEAMNO         INTEGER      NOT NULL,
    ->          EmployeeNO       INTEGER      NOT NULL,
    ->          DIVISION       CHAR(6)      NOT NULL,
    ->          PRIMARY KEY    (TEAMNO)             );
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql>
mysql> INSERT INTO TEAMS VALUES (1,  6, 'first');
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO TEAMS VALUES (2, 27, 'second');
Query OK, 1 row affected (0.00 sec)

mysql>
mysql> REPLACE INTO TEAMS (TEAMNO, EmployeeNO, DIVISION)
    -> VALUES (6, 100, 'third'),
    ->        (7,  27, 'fourth'),
    ->        (8,  39, 'fourth'),
    ->        (9, 112, 'sixth');
Query OK, 4 rows affected (0.00 sec)
Records: 4  Duplicates: 0  Warnings: 0

mysql>
mysql>
mysql> drop table teams;
Query OK, 0 rows affected (0.00 sec)

mysql>

   
    
    
    
    
    
  








Related examples in the same category

1.Call REPLACE function in select clause
2.Call concat and replace
3.Do calculation in select clause
4.MySQL replace command
5.Replace into
6.Use the REPLACE command to remove the underscores and insert spaces in their place.