Below are some of the basic SQL statements which we use in day to day work.

sql tutorial for beginners

Create Table
To create a new Table in Data Base use below syntax

create table table_name (
column1 datatype,
column2 datatype,

Example :-

create table onlineqa (empno number(4),ename varchar2(10),dept varchar2(9));

Drop or Delete a Table
To Drop an existing table from Database. Dropping a table from database deletes the table completely with structure from database.
If you want to delete the Rows from the entire table use the Truncate command instead.

drop table table_name;

Example :-

drop table onlineqa; 

Truncate a Table
To delete or remove all the rows from the a table we use the Truncate command. Truncate command will not delete the Table itself, it will remove data inside a table.

truncate table table_name;

Example :-

truncate table onlineqa; 

Alter a Table
To Add a column or Delete a column or Modify a column in an existing Table we use Alter command.
Alter table to Add Column

Alter Table table_name
Add column_name datatype; 

Example :-

Alter Table onlineQA
Add empName VARCHAR(30); 

Alter table to Delete or Drop a Column

Alter Table table_name
drop column column_name

Example :-

Alter Table onlineQA
drop column empName; 

Alter table to Modify an Existing Column

Alter Table table_name
Modify column_name datatype; 

Note:- In case of Sql server use “Alter” instead of “Modify”.
Example :-

Alter Table onlineQA
Modify column empName Varchar2(40);