Here’s How to Alter Column Datatype in SQL

SQL query to alter datatype

ALTER TABLE BOOKS ALTER BOOKNAME SET DATA TYPE VARCHAR(200) ALTER ISBN SET DEFAULT ‘UNKNOWN’;

Certain characteristics of a table cannot be changed. For example, you cannot change the table space in which the table resides, the order of columns, or change the data type of a column to an incompatible data type . To change characteristics such as these, save the table data, drop the table, and then recreate it.

SQL query to drop table

The DROP TABLE statement removes a table from the database, deleting the data and the table definition. If there are indexes or constraints defined on the table, they are dropped as well.
The DROP TABLE statement, as shown in Listing 6, deletes the BOOKS table and its data:
==>Delete table and data
DROP TABLE BOOKS;

Related Posts

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.