Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8948457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:59:44+00:00 2026-06-15T12:59:44+00:00

I have to create 8 tables with the exact same structure. The easiest way

  • 0

I have to create 8 tables with the exact same structure. The easiest way is to copy-paste the code and apply different names for the tables. I want to be cool and create them with one cycle. How can I make that cycle and what is best way to apply the different names ? Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T12:59:45+00:00Added an answer on June 15, 2026 at 12:59 pm

    The fastest method for creating tables with duplicate structures would be as follows:

    CREATE TABLE tb1
    (
        id int not null auto_increment,
        ...,
        primary key (id)
    );
    create table tb2 like tb1;
    create table tb3 like tb1;
    create table tb4 like tb1;
    ...
    create table tb8 like tb1;
    

    This copies both the table structure and corresponding indexes.

    If you need to make a table without indexes, this may be OK for you

    CREATE TABLE tb1
    (
        id int not null auto_increment,
        ...,
        primary key (id)
    );
    CREATE TABLE tb2 AS SELECT * FROM tb1 WHERE 1=2;
    

    Depending on columns definitions, this may or may not work.

    CAVEAT

    This cannot be do for a table with foreign key constraints. That would be done in stages.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database schema that contains multiple tables with different names, but all
I have a two databases that contain the exact same tables and are on
I have two tables with the exact same schema in SQL Server 2008 Standard
In my dbsql file, I have two CREATE TABLES the first works and the
i have 2 tables CREATE TABLE if not exists tag_name( + tagid INTEGER PRIMARY
I have 2 tables: CREATE TABLE `product_det` ( `id` bigint(12) unsigned NOT NULL AUTO_INCREMENT,
I have several tables: CREATE TABLE [dbo].[Tracks]( [Id] [uniqueidentifier] NOT NULL, [Artist_Id] [uniqueidentifier] NOT
Suppose that we have following tables create table Employee( 2 EMPNO NUMBER(3), 3 ENAME
Here's the scenario: I have 2 tables: CREATE TABLE dbo.API_User ( id int NOT
I have an Android application that uses the Android database to create tables and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.