Solved

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

Posted on 2008-10-23
10
615 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
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

A lot of articles have been written on splitting mysqldump and grabbing the required tables. A long while back, when Shlomi (http://code.openark.org/blog/mysql/on-restoring-a-single-table-from-mysqldump) had suggested a “sed” way, I actually shell …
Foreword This is an old article.  Instead of using the MySQL extension that was used in the original code examples, please choose one of the currently supported database extensions instead.  More information is available here: MySQLi / PDO (http://…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

776 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