Questions tagged [drop-table]

The SQL command for deleting an entire table.

DROP TABLE is used in SQL to remove a table.

152 questions
15
votes
6 answers

hive - how to drop external hive table along with data

I am using drop table If I recreate the table with the same schema and name, I am getting the old data back. Should I remove the table directory from hdfs file system to completely get rid of the data?
amrk7
  • 1,194
  • 5
  • 13
  • 33
13
votes
1 answer

aiopg + sqlalchemy: how to "drop table if exists" without raw sql?

I am looking at examples of aiopg usage with sqlalchemy and these lines scare me: async def create_table(conn): await conn.execute('DROP TABLE IF EXISTS tbl') await conn.execute(CreateTable(tbl)) I do not want to execute raw sql queries…
sanyassh
  • 8,100
  • 13
  • 36
  • 70
13
votes
2 answers

How to drop a single Postgres table in a Ruby on Rails Heroku app?

Similar question here, but none of the answers actually answer the question. The accepted answer just shows how to log in to console and destroy all records. This is not what I need in this case. I need to completely scrap a single table (it has no…
sergserg
  • 21,716
  • 41
  • 129
  • 182
11
votes
3 answers

Drop MySQL table using Liquibase

I am looking to drop a table in MySQL using Liquibase only if the table exists. I am not able to figure out how to check if a table exists in Liquibase.
Arpit
  • 521
  • 2
  • 8
  • 22
9
votes
1 answer

Rails 4: How to drop or remove (join) tables tables from database?

In the Rails 4 documentation (http://guides.rubyonrails.org/migrations.html#creating-a-join-table) I see that to drop a table or a join table, one can use the following methods in command line: drop_table and drop_join_table. However, it further…
robskrob
  • 2,720
  • 4
  • 31
  • 58
5
votes
2 answers

Create table but Drop it if the table exists already

I am working on a request where I have to create a table to insert some data. So, obviously I will have first have a delete table st. before the create st. but when I am running this for the first time(before the table can be created) it will pop up…
user1172117
  • 169
  • 2
  • 3
  • 6
5
votes
2 answers

How to delete every table in a specific schema in postgres?

How do I delete all the tables I have in a specific schema? Only the tables in the schema should be deleted. I already have all the table names that I fetched with the code below, but how do delete all those tables? The following is some psycopg2…
GoldenRetriever
  • 155
  • 3
  • 11
5
votes
1 answer

JPA Entity Manager - How to run SQL script file?

I have an SQL script file which drops and recreates various tables as well as inserts various records into these tables. The script runs fine when executing in the SQL query console however I need it to be executed by the Entity Manager. Any idea's…
Harvey Sembhi
  • 287
  • 1
  • 5
  • 13
5
votes
2 answers

MYSQL Table drop after x hours

Is it possible to write extra code into a mysql table creation that will make it drop itself after X amount of time? Like a temp table, but it will last longer. I need to create tables for temporary tasks, but i need them to last longer than a…
cardi777
  • 563
  • 2
  • 9
  • 22
4
votes
1 answer

Dropping multiple tables at once

SQL Server supports DIE syntax(drop table if exists): Multiple tables can be dropped in any database. If a table being dropped references the primary key of another table that is also being dropped, the referencing table with the foreign key must…
Lukasz Szozda
  • 162,964
  • 23
  • 234
  • 275
4
votes
1 answer

How can I delete all tables from a Firebird 3.0 database using single query?

I'm working on JSF application that uses a Firebird 3.0 database containing hundreds of tables. I need to delete all tables time to time. I have checked this query: DROP TABLE TABLE_NAME but only one table can be deleted at a time by using this…
Nitin Upadhyay
  • 113
  • 1
  • 15
4
votes
4 answers

How to drop a 1000+ databases with innodb_file_per_table=1 without hanging the MySQL process?

We have a recurring process in which we want to, and need to, clean up our databases. Every client or prospect gets its own database (with 300 tables, and increasing every month), which is spun up within seconds, and seeded with some basic…
Mave
  • 2,413
  • 3
  • 28
  • 54
4
votes
2 answers

How to remove dropCollection access right from users in MongoDB?

Created a MongoDB user with readWrite access to a collection. But I don't want to give dropCollection access right to that user. How can I implement that. Thanks.
Parth mehta
  • 1,468
  • 2
  • 23
  • 33
4
votes
1 answer

What happens to dependent triggers when the table is dropped?

I have one table backup on which I had applied one trigger upd_trig. Now, I dropped my table and then I checked, whether all the associated trigger/index will also been dropped or will remain there. As I found some discussion here,and they said…
Ravi
  • 30,829
  • 42
  • 119
  • 173
4
votes
3 answers

DROP TABLE not work in sqlite

I try to drop table programmatically nothing error show in logcat, but there has no any result : Here my Database Helper class : public class database1 extends SQLiteOpenHelper { private static final String DB_Name="database"; private…
Edward Sullen
  • 157
  • 1
  • 5
  • 18
1
2
3
10 11