Answers for "alter table table_name drop column if exist column_name;"

SQL
1

drop column if exists sql server

-- SQL Server
ALTER TABLE t DROP COLUMN IF EXISTS col1, 
                   COLUMN IF EXISTS col2;
Posted by: Guest on August-13-2021
0

if a specific column name is present drop tyhe column

df.columns.str.startswith('Test')
# array([ True, False, False, False])

df.loc[:,~df.columns.str.startswith('Test')]

  toto test2 riri
0    x     x    x
1    x     x    x
Posted by: Guest on November-21-2019

Code answers related to "alter table table_name drop column if exist column_name;"

Code answers related to "SQL"

Browse Popular Code Answers by Language