?
Solved

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

Posted on 2008-10-23
10
Medium Priority
?
621 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 1500 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

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 this article, we’ll look at how to deploy ProxySQL.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

770 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