Sunday 11 October 2015

Differences Between Oracle and PostgreSQL Queries

The Queries which are used in this video: https://youtu.be/fN5SyxnvhEg




Differences
Oracle
PostgreSQL
Total Database Tables
·       select * from tab;

Total Database Tables
·       select * from pg_tables where schemaname='public';
Table Description
·       desc demo;

Table Description
·       select * from demo;
Table Creation
·       create table emp (eno integer , ename varchar2(25),dob date);

Table Creation
·       create table emp (eno integer , ename character varying(25),dob date);
Insert Row
·       insert into emp values(100,'Suresh','10-jan-1990');

Insert Row
·       insert into emp values(100,'Suresh','10-jan-1990');

Insert Null Value to Date
·       insert into emp values(101,'Ramesh','');

Insert Null Value to Date
·       insert into emp values(101,'Ramesh',null);
Update Row
·       update emp set eno='102' where ename='Ramesh';
Update Row
·       update emp set eno='102' where ename='Ramesh';
Insert null to Integer
·       insert into emp values('','Vijay','10-mar-1988');
Insert null to Integer
·       insert into emp (ename,dob) values('Vijay','10-mar-1988');
Insert null to String
·       insert into emp values(104,'','10-mar-1980');

Insert null to String
·       insert into emp values(104,'','10-mar-1980');

Insert null to String
·       insert into emp values(105,null,'10-mar-1980');

Insert null to String
·       insert into emp values(105,null,'10-mar-1980');

Retrive Null Value Row
·       select eno,nvl(ename,'test'),dob from emp ;

Retrive Null Value Row
·       select eno,coalesce(ename,'test'),dob from emp ;



No comments:

Post a Comment

Share It

Followers