Sometimes you may need to remove table or delete table in Amazon Redshift database. In this article, we will look at how to drop table in Redshift.
How to Drop Table in Redshift
It is very easy to drop table in Redshift using DROP TABLE command.
Here is its syntax
DROP TABLE table_name
For example, here is the SQL query to drop table sales(id, amount) in Redshift.
DROP TABLE sales;
Also read : How to Copy Table in Redshift
Please note, once you delete a table in Redshift, you cannot recover it back.
For example, if you drop a table and then try selecting its rows, you will get an error.
# drop table sales; DROP TABLE # select * from sales; ERROR: relation "sales" does not exist LINE 1: select * from sales;
So please be very sure and careful when you drop table.
Sreeram has more than 10 years of experience in web development, Python, Linux, SQL and database programming.