I am using R on Linux/Ubuntu machine. I am using RMySQL package to connect to a MySQL database
I need to drop a table from that database and would like to know a suitable command. I already looked the package documentation and searched for "drop" and "DROP" but didnt find anything :(
I drop table in case of SQL server and RODBC package by using sqlDrop command. I want it's equivalent for RMySQL package
Dropping tables in RMySQL
is handled by the dbRemoveTable
function. If you want to remove a table named test
you can (assuming conn
is your connection object):
dbRemoveTable(conn,"test")
Alternatively, you can use dbGetQuery
to execute a command directly in MySQL (even if it doesn't return the result of a query). For instance:
dbGetQuery(conn,"DROP TABLE test")