POSTGRESQL DATABASE INTERVIEW QUESTIONS
What does the SELECT * statement do in PostgreSQL?
How would you use SELECT * to retrieve all data from a table named customers?
Can you explain the difference between SELECT * and specifying column names in the SELECT statement?
Why might using SELECT * in a production environment be discouraged?
How can using SELECT * affect query optimization in PostgreSQL?
Is there any way to limit the number of rows returned when using SELECT * in PostgreSQL?
How does PostgreSQL handle SELECT * in terms of internal query processing and execution plans?
How can the use of SELECT * impact data transfer and network performance in a distributed database setup?
What are some best practices for using SELECT * in complex queries involving multiple joins and subqueries?
In both PostgreSQL and Oracle, what are the implications of using SELECT * in a view definition, and how might this affect future schema changes?
How do you query a hierarchy of employees in PostgreSQL when the employee table has a manager ID that points to their supervisor?
How can you represent a hierarchy of employees in PostgreSQL?
How would you query all employees reporting directly to a specific manager in PostgreSQL?
How can you retrieve all employees under a specific manager, including indirect reports (multi-level hierarchy)?
How do you determine the hierarchy level (depth) of an employee in the organization?
To fetch ALTERNATE records from a table. (EVEN NUMBERED)
To select ALTERNATE records from a table. (ODD NUMBERED)
Find the 3rd MAX salary in the emp table.
Find the 3rd MIN salary in the emp table.
Select FIRST n records from a table.
Select LAST n records from a table
List dept no., Dept name for all the departments in which there are no employees in the department.
How to get 3 Max salaries ?
How to get 3 Min salaries ?
How to get nth max salaries ?
Select DISTINCT RECORDS from emp table.
How to delete duplicate rows in a table?
Count of number of employees in department wise.
Suppose there is annual salary information provided by emp table. How to fetch monthly salary of each and every employee?
Select all record from emp table where deptno =10 or 40.
Select all record from emp table where deptno=30 and sal>1500.
Select all record from emp where job not in SALESMAN or CLERK.
Select all record from emp where ename in 'BLAKE','SCOTT','KING'and'FORD'.
Select all records where ename starts with ‘S’ and its lenth is 6 char.
Select all records where ename may be any no of character but it should end with ‘R’.
Count MGR and their salary in emp table.
In emp table add comm+sal as total sal .
Select any salary <3000 from emp table.
Select all salary <3000 from emp table.
Select all the employee group by deptno and sal in descending order.
How can I create an empty table emp1 with same structure as emp?
How to retrive record where sal between 1000 to 2000?
Select all records where dept no of both emp and dept table matches.
If there are two tables emp1 and emp2, and both have common record. How can I fetch all the recods but common records only once?
How to fetch only common records from two tables emp and emp1?
How can I retrive all records of emp1 those should not present in emp2?
Count the totalsa deptno wise where more than 2 employees exist.
Query to find second highest salary of Employee
Find nth maximum salaries
Fetch ALTERNATE records from a table. (EVEN Numbered)
Select First n records from a table
Select Last n records from a table
Delete Duplicate Rows in a table
Count MGR and their salary in employee table
Add comm+salary as total salary
Retrieve record from salary between 1000 to 2000
Retrieve department-wise totalsalary for departments with more than 2 employees
