Questions tagged [drop-table]

The SQL command for deleting an entire table.

DROP TABLE is used in SQL to remove a table.

140 questions
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
  • 1,986
  • 3
  • 19
  • 36
8
votes
3 answers

Avoid exclusive access locks on referenced tables when DROPping in PostgreSQL

Why does dropping a table in PostgreSQL require ACCESS EXCLUSIVE locks on any referenced tables? How can I reduce this to an ACCESS SHARED lock or no lock at all? i.e. is there a way to drop a relation without locking the referenced table? I can't…
Dave
  • 36,791
  • 8
  • 53
  • 96
7
votes
2 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
  • 361
  • 1
  • 5
  • 18
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
  • 119
  • 2
  • 2
  • 5
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
  • 283
  • 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
  • 544
  • 2
  • 9
  • 18
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
  • 120,610
  • 18
  • 161
  • 197
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…
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,301
  • 3
  • 23
  • 51
4
votes
3 answers

How to solve : SQL Error: ORA-00604: error occurred at recursive SQL level 1

When I'm trying to drop table then I'm getting error SQL Error: ORA-00604: error occurred at recursive SQL level 2 ORA-01422: exact fetch returns more than requested number of rows 00604. 00000 - "error occurred at recursive SQL level %s" *Cause: …
Ravi
  • 28,657
  • 41
  • 110
  • 158
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,376
  • 1
  • 22
  • 29
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
  • 167
  • 1
  • 5
  • 18
3
votes
2 answers

Oracle - Unable to drop tables

This question is related to the one I posted yesterday but with further implications. The situation is: I'm unable to drop ANY table. Here's an example: SQL> CREATE TABLE FOO (BAR NUMBER) TABLESPACE SYSTEM / Table created. SQL> SELECT COUNT(1)…
jpaires
  • 335
  • 6
  • 13
3
votes
1 answer

When adding column, I have to create and drop instead of alter?

I'm trying to add a column to the end of a table in SQL like so: Open Design view Add column Generate and copy script Run, then save script For some reason, when my colleagues do this, it generates the usual ALTER TABLE script. When I attempt…
Jessica
  • 1,441
  • 1
  • 14
  • 27
3
votes
1 answer

Double loop with drop table in MSSQL

I've while loop inside while loop and both loops do some modifications of one table. I receive an error that table already exists. Below simple example of this problem. Could someone clarify why this doesn't work? I know how to bypass this problem…
Tomek Tarczynski
  • 2,614
  • 8
  • 33
  • 42
1
2
3
9 10