Solved

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

Posted on 2008-10-23
10
613 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
  • 5
  • 3
  • 2
10 Comments
 
LVL 6

Accepted Solution

by:
cr4ck3rj4ck earned 500 total points
Comment Utility
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
Comment Utility
How about drop row?? (second instruction)

will it be

ALTER TABLE table_name DROP ROW column_name
0
 
LVL 9

Expert Comment

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

Regards
0
 
LVL 9

Author Comment

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

Expert Comment

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

delete from table_name where field_name=Any_criteria
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 9

Author Comment

by:antontolentino
Comment Utility
that is how I will execute this?

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

Expert Comment

by:michofreiha
Comment Utility
0
 
LVL 9

Author Comment

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

Expert Comment

by:cr4ck3rj4ck
Comment Utility
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
Comment Utility
Thanks. I manage to remove the rows by browsing from phpmyadmin.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

728 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now