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

  • Home
  • SEARCH
  • 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 3392248
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:53:54+00:00 2026-05-18T03:53:54+00:00

I have a table that was created using this mysql statement below. CREATE TABLE

  • 0

I have a table that was created using this mysql statement below.

CREATE TABLE `jos_ttvideo` (
 `id` int(11) NOT NULL auto_increment,
 `video_id` int(11) NOT NULL DEFAULT 0,
 `thumbnail` varchar(255) NOT NULL DEFAULT "",
 `thumbnail_med` varchar(255) NOT NULL DEFAULT "",
 `thumbnail_lrg` varchar(255) NOT NULL DEFAULT "",
 `title` varchar(50) NOT NULL DEFAULT "",
 `author` varchar(50) NOT NULL DEFAULT "",
 `description` varchar(255) NOT NULL DEFAULT "",
 `full_description` text NOT NULL DEFAULT "",
 `c_date` DATETIME NOT NULL,
 `plays` int(11) NOT NULL DEFAULT 0,
 `likes` int(11) NOT NULL DEFAULT 0,
 `width` int(4) NOT NULL DEFAULT 600,
 `height` int(4) NOT NULL DEFAULT 300,
 `published` tinyint(1) NOT NULL DEFAULT 0,
 `checked_out` tinyint(1) NOT NULL DEFAULT 0,
 `catid` int(10) UNSIGNED NOT NULL DEFAULT 0,
  PRIMARY KEY  (`id`)
);

Now I want to create a mysql update script that that will preserve any data contained in the table and add & update certain columns. So once done the table structure will look like below:

CREATE TABLE IF NOT EXISTS `jos_ttvideo` (
 `id` int(11) NOT NULL auto_increment,
 `video_id` varchar(255) NOT NULL DEFAULT 0,
 `site` varchar(20) NOT NULL DEFAULT "",
 `thumbnail` varchar(255) NOT NULL DEFAULT "",
 `thumbnail_med` varchar(255) NOT NULL DEFAULT "",
 `thumbnail_lrg` varchar(255) NOT NULL DEFAULT "",
 `title` varchar(50) NOT NULL DEFAULT "",
 `author` varchar(50) NOT NULL DEFAULT "",
 `description` varchar(255) NOT NULL DEFAULT "",
 `full_description` text NOT NULL DEFAULT "",
 `c_date` DATETIME NOT NULL,
 `plays` int(11) NOT NULL DEFAULT 0,
 `likes` int(11) NOT NULL DEFAULT 0,
 `width` int(4) NOT NULL DEFAULT 600,
 `height` int(4) NOT NULL DEFAULT 300,
 `custom_dimensions` tinyint(1) NOT NULL DEFAULT 0,
 `published` tinyint(1) NOT NULL DEFAULT 0,
 `checked_out` tinyint(1) NOT NULL DEFAULT 0,
 `catid` int(10) UNSIGNED NOT NULL DEFAULT 0,
  PRIMARY KEY  (`id`)
);

Essentially there are 2 ways I can think of doing this:

  1. create a temp table using the 2nd mysql script, copy data from the original table to the temp one, drop the original one, rename the temp table to the original table name
  2. run an alter table statement for each column change and add of column.

What is the best way to do this? Because there are only a few changes to the table structure I think option 2 would be an easier route. However, should there be many more changes as could well be the case in the future, then I think option 1 would be better. If I go with option 1, what mysql is needed to copy the original table data to the temp table?

Thanks for the help!

  • 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-05-18T03:53:54+00:00Added an answer on May 18, 2026 at 3:53 am

    As long as you have/can create the ALTER TABLE there is no need for option 1 at all, because that’s exactly what MySQL does by itself when you use option 2.

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

Sidebar

Related Questions

I have an ISAm table in mySql that was created similar to this: create
I created this using MySQL WorkBench CREATE TABLE IF NOT EXISTS `bakasura_new`.`cities` ( `id`
I have a table that is created in a DataList in ASP.Net. This table
I have created a multi column datastore on a table that allows me to
Ok, I have one JavaScript that creates rows in a table like this: function
I have created a report in SSRS that contains 2 matrices (not tables/lists), each
I have the following script to create a table in MySQL version 5.1 which
I have a small form inside a table. POSTing that form creates a new
I have created a Python module that creates and populates several SQLite tables. Now,
I have a DTS package that drops a table then creates it and populates

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.