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 9167183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:19:40+00:00 2026-06-17T15:19:40+00:00

I have a large group of columns in a table (50+) which contain some

  • 0

I have a large group of columns in a table (50+) which contain some statistics about a game.

We are simplifying our statistics, so now we want to do two things.

  • Drop any columns where the name contains ‘%_nd%’
  • Remove the string ‘_er’ from any column names.

Is there an easy way to do this automatically, or do I need to enter all the column names manually?

  • 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-17T15:19:41+00:00Added an answer on June 17, 2026 at 3:19 pm

    Well you can do the first by running the following and using the SQL it produces:

    select distinct concat('alter table ',table_name,' drop column ',column_name) someSql
    from information_schema.columns
    where column_name like '%_nd%'
    

    You could do the second with a similar query:

    select distinct concat('alter table ',table_name,' change ',column_name, ' ', replace(column_name, '_er', ''), ' ', data_type, case when CHARACTER_MAXIMUM_LENGTH is not null then concat('(', CHARACTER_MAXIMUM_LENGTH, ')') end) someSql
    from information_schema.columns
    where column_name like '%_er%'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have large database table, approximately 5GB, now I wan to getCurrentSnapshot of Database
I have large table. consisting of only 3 columns (id(INT),bookmarkID(INT),tagID(INT)).I have two BTREE indexes
Background I have a table which has six columns. The first three columns create
I have a large R data.table with a multi column key, where some value
I have a very large table (few million records). The columns in the table
I have a relatively large (as in >10^6 entries) table called things which represent
I have a large table (2M+ records with loads of columns). I intend to
I have a large scene graph in Java 3D consisting out of a Group
I have large table, with around 200 fields. Around a 100 of those fields
I have large set of flow charts and workflow diagrams. I want to draw

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.