Solved

SQL command for phpmyadmin to drop/remove some tables and rows

Posted on 2008-10-23
10
618 Views
Last Modified: 2012-08-14
Hi,

I had an experience from phpmyadmin where my intention is to remove only a row but i endup removing the entire table. I dont want that to happen again so I would ask for experts code :)

I want to carry out this instruction via phpmyadmin.


=======================
REMOVE the column "user_gallery_notify" FROM "the phpbb3_users" table,

REMOVE the row "gallery_version" FROM the "phpbb3_config" table,

and then FROM the modules table to find (by langname) and REMOVE the rows
"ACP_CAT_GALLERY"
"ACP_GALLERY_MANAGEMENT"
"ACP_GALLERY_MANAGE_ALBUMS"
"ACP_GALLERY_CREATE_ALBUM"
"ACP_GALLERY_MANAGE_CACHE"
"ACP_GALLERY_SETTINGS"
"ACP_GALLERY_GENERAL_SETTINGS"
"ACP_GALLERY_USER_SETTINGS"
"ACP_GALLERY_GUEST_SETTINGS"
"ACP_GALLERY_WATERMARK_SETTINGS"
"UCP_GALLERY_PREFS"

Then drop the main gallery tables

"phpbb3_gallery_albums"
"phpbb3_gallery_comment"
"phpbb3_gallery_config"
"phpbb3_gallery_pics"
"phpbb3_gallery_rate"
"phpbb3_gallery_users"
====================
0
Comment
Question by:antontolentino
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
10 Comments
 
LVL 6

Accepted Solution

by:
cr4ck3rj4ck earned 500 total points
ID: 22785009
The syntax for removing a column is as follows:

ALTER TABLE table_name DROP COLUMN column_name

To delete a table:

DROP TABLE table_name

Simply replace the table_name and column_name with what you want and hey presto :)
0
 
LVL 9

Author Comment

by:antontolentino
ID: 22785064
How about drop row?? (second instruction)

will it be

ALTER TABLE table_name DROP ROW column_name
0
 
LVL 9

Expert Comment

by:michofreiha
ID: 22785197
You cannot drop a row...The row contains data related to different columns

Regards
0
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 
LVL 9

Author Comment

by:antontolentino
ID: 22785329
then that would mean the instruction is not correct?
0
 
LVL 9

Expert Comment

by:michofreiha
ID: 22785404
No of course Not...You can remove a row by making a delete query:

delete from table_name where field_name=Any_criteria
0
 
LVL 9

Author Comment

by:antontolentino
ID: 22785826
that is how I will execute this?

REMOVE the row "gallery_version" FROM the "phpbb3_config" table,
0
 
LVL 9

Expert Comment

by:michofreiha
ID: 22785969
0
 
LVL 9

Author Comment

by:antontolentino
ID: 22789787
I still don't understand.. can you just translate the ROW deletion part into exact sql command.
0
 
LVL 6

Expert Comment

by:cr4ck3rj4ck
ID: 22793996
gallery_version is not a row, it is a column name. The following would get rid of the column from the table:

ALTER TABLE phpbb3_config DROP COLUMN gallery_version
0
 
LVL 9

Author Closing Comment

by:antontolentino
ID: 31509150
Thanks. I manage to remove the rows by browsing from phpmyadmin.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction In this article, I will by showing a nice little trick for MySQL similar to that of my previous EE Article for SQLite (http://www.sqlite.org/), A SQLite Tidbit: Quick Numbers Table Generation (http://www.experts-exchange.com/A_3570.htm…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question