Search
 
SCRIPT & CODE EXAMPLE
 

SQL

how to duplicate table in mysql

CREATE table `duplicat` LIKE `orginal`;
INSERT `duplicat` SELECT * FROM `orginal`;
Comment

how to duplicate mysql table

-- You can duplicate or "clone" a table's contents by executing
> CREATE TABLE new_table AS SELECT * FROM original_table;

-- keep in mind that new new_table inherits ONLY the basic column definitions, null settings
-- and default values of the original_table. It does not inherit indexes and auto_increment
-- definitions.
-------------------------------------------------------------------------------------------

-- To inherit all table definitions
> CREATE TABLE new_table LIKE original_table; -- copy table structure only
> INSERT INTO new_table SELECT * FROM original_table; -- add data from old table
Comment

duplicate record mysql

SELECT firstname, 
   lastname, 
   list.address 
FROM list
   INNER JOIN (SELECT address
               FROM   list
               GROUP  BY address
               HAVING COUNT(id) > 1) dup
           ON list.address = dup.address;
Comment

duplicate row mysql

# Duplicate rows or row
INSERT INTO table (col1, col2, col3)
SELECT col1, col2, col3 FROM table
WHERE something...;
Comment

PREVIOUS NEXT
Code Example
Sql :: oracle search source code 
Sql :: raise application error in oracle 
Sql :: wordpress change url in database 
Sql :: Find all tables containing column with specified name - MS SQL Server 
Sql :: VERIFY INDEXES IN SQL ORACLE 
Sql :: reset identity column in sql server 
Sql :: postgresql print sessions using the database 
Sql :: primary key reset in SQL database 
Sql :: sql skip the first row 
Sql :: how to check last gather stats on table in oracle 
Sql :: sqlite list columns 
Sql :: find a column in all tables postgres 
Sql :: PLS-00225 type 
Sql :: adding a default constraint to an existing column in sql 
Sql :: mysql increment value by 1 in update 
Sql :: psql list rules 
Sql :: sql try catch 
Sql :: create table if not exists sql 
Sql :: oracle reset sequence 
Sql :: node and mysql like 
Sql :: mssql remove column 
Sql :: import local sql into remote mysql 
Sql :: how to copy data of a table from another database to table of anaother database 
Sql :: nvl postgres 
Sql :: host is not allow to connect to this mysql server 
Sql :: postgresql division count return 0 
Sql :: mysql user permission database 
Sql :: sql server for loop 
Sql :: create table mysql example auto_increment 
Sql :: mysql error codeigniter 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =