Postgres SQL
1. DDL :- create, alter, truncate, drop
2. DML :- insert, update,
create database Rishav31;
create table student(
rollno int,
name varchar,
course varchar,
fees decimal(10,2)
);
Note- if existing table have unique identity then we make it primary key
drop table student;
create table marks(
rollno int not null primary key,
name varchar,
java int,
pyrthon int,
dsa int,
sql int
);
insert into marks values(1001,'amit',50,60,58,78),
(1002,'sumit',18,56,78,45),
(1003,'pankaj',55,78,36,59),
(1004,'kamal',69,77,45,89);
select *from marks;
select java+pyrthon+dsa+sql as total from marks;
alter table marks add column totalmarks int,add column per decimal(2,2);
Postgres SQL
alter table marks add column totalmarks int,add column per decimal(5,2);
note:- Unique can be null it can be a primary key.
Note:-
Smallserial 2byte 1 to 65536
Serial 4byte 1 to 2,147,483,147
Bigserial 8byte