Solved

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

Posted on 2008-10-23
10
619 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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
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

Webinar: Choosing a MySQL HA Solution

Join Percona’s Principal Technical Services Engineer, Marcos Albe as he presents Choosing a MySQL High Availability Solution on Thursday, June 29, 2017 at 10:00 am PDT / 2:00 pm EDT (UTC-7).

Question has a verified solution.

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

I have been using r1soft Continuous Data Protection (http://www.r1soft.com/linux-cdp/) for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

724 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