Questions tagged [drop-table]

The SQL command for deleting an entire table.

DROP TABLE is used in SQL to remove a table.

152 questions
2
votes
5 answers

Drop table from oracle database if table exist in sql statement

I have to use an SQL statement to drop a table, it will crash if the table doesn't exist. Is it possible to use IF statement to drop the table s.executeUpdate("DROP TABLE employee");
user3500109
  • 33
  • 1
  • 1
  • 3
2
votes
1 answer

Drop table, then cannot recreate table with the same name

I first drop a table in SQL Server 2008 (after that it shows the message that the command was executed sucessfully). I then tried to create a table with the same name, and it showed me an error. After closing the SSMS window and re opening it it…
Shadab Shah
  • 85
  • 1
  • 2
  • 6
1
vote
1 answer

Drop query in sqlite

Possible duplicate Hello all. I have confusion in drop query that how actually it work in internally. I heard one of my post that someone says that when we use drop query then internally it'll be used delete query. So my question is, Is it true that…
Pratik
  • 30,639
  • 18
  • 84
  • 159
1
vote
2 answers

Drop table in mysql with Create statement

I'm facing this issue where I'm trying to drop the table if it exists but I keeping getting error. Here's what I have DROP TABLE IF EXISTS clips_cur; CREATE TEMPORARY TABLE clips_cur( SELECT year_r, month_n_r, IFNULL(SUM(current_clip_count),0) as…
dummyboi
  • 11
  • 3
1
vote
1 answer

Recreate an existing Trigger on Table Drop/Create?

I have an insurance claims table (TableX for this example) as well as an Audit table (TableXAudit). The trigger associated with TableX inserts records on Insert, Update and Delete (as you would expect an audit trigger to do). However, TableX is…
Bronco638
  • 11
  • 2
1
vote
1 answer

SQL DROP query request

I used DROP ecommerce.users; but it shows error #1064. Kindly help.
Shriya S
  • 37
  • 4
1
vote
3 answers

SQL iterate through tables and drop if not certain name

I want to drop almost all the tables in my database (9000 in total). Don't ask me why they are so many, too long to explain. So I have 3 tables that I don't want to drop. What SQL statement can I use to do this? I have been google-ing for a while…
Andrei Chirtes
  • 221
  • 4
  • 13
1
vote
1 answer

Speed in deleting records in SQL table

I have a temp table used for intermediate calculation in a stored procedure. Here is code segment: CREATE TABLE #Updates ( ID int not null, ID2 int not null, ID3 int not null ); -- Do some operations and updates IF…
user3097695
  • 1,152
  • 2
  • 16
  • 42
1
vote
0 answers

How to remove user privileges associated with the dropped table?

When I was reading about the DROP TABLE statement in MySQL, I came across the term RESTRICT & CASCADE. On one website, click here to goto that link where I found information stating, Note that the DROP TABLE statement only drops tables. It doesn’t…
saint_sharan
  • 119
  • 1
  • 12
1
vote
1 answer

Why does my code not reach the second execute method?

I have a method called dropTable that sends a SQL query to a database to check whether a table exists or not. If it does, it drops the table. I send another query telling it to create a table. When I run the code, I get an error saying ERROR:…
Jake Jackson
  • 1,055
  • 1
  • 12
  • 34
1
vote
3 answers

How to drop rows in pandas matсhing on a columns and satisfying an equation on another column?

I am dealing with some finanial data containing reversals. Reversals are basically a correction in a table that offsets another values in the table by adding in the table an equal amount of the opposite sign. My job is to clear those values. Take…
callmeGuy
  • 944
  • 2
  • 11
  • 28
1
vote
2 answers

SQLite "Drop table" error message: "SQL logic error or missing database"

I am running a SQLite database in memory and I am attempting to drop a table with the following command. DROP TABLE 'testing' ; But when I execute the SQL statement, I get this error SQL logic error or missing database Before I run the "Drop…
Steven Smethurst
  • 4,495
  • 15
  • 55
  • 92
1
vote
1 answer

SQLite3::ConstraintException: FOREIGN KEY constraint failed: DROP TABLE users

How to disable(I don't know the correct term yet) foreign keys before DROP TABLE? OR correct way to drop a table? followed steps provided here Image link got the same error again SQLite3::ConstraintException: FOREIGN KEY constraint failed: DROP…
robincEPtion
  • 47
  • 2
  • 10
1
vote
2 answers

I'm trying to figure out the order my drop tables and create tables should be in if someone can help me out

I can't figure out the order my drop tables and create tables should be in. I'm creating a knockoff soccer registration database. Originally I was fine but wanted to make it more complex and since then I can't figure out the order everything is…
1
vote
0 answers

unable to drop or alter table on postgresql

We recently encountered a problem using the postgres-xl software, there is a table we can not drop can not alter, will always be in the execution state. We checked the Internet, and some answered that the table is locked, but the lifting of the lock…
weishibo
  • 11
  • 3