-
-
-
There are 2 tables, Employee and Department. There are few records in employee table, for which, the department is not assigned. The output of the query should contain all th employees names and their corresponding departments, if the department is assigned otherwise employee names and null value in the place department name. What is the query?
Select emp_name, Dept_name from (Employee_table left outer join Dept_table on Employee_table.Dept_id = Dept_table.Dept_id)
-
Count Records
I have following table as books101 BOOK_NO BOOK_NAME AUTHOR_NAME COST CATEGORY1234 C Dennis 450 System1235 Oracle Loni 550 Database1236 Sql Loni 250 Database1237 Pl/Sql Scott 750 Database Now I want to List all the authors and book name that has more then 1 book written by them.pls help
-
-
-
-
Query to find amout of salary hike
In table "salary" with emp_no,sal_dt,salary which records salary of all employees every month.find the query to give the amount of salary hike and date of hike for all the employees.
-
INSERT Statement Optimization
A script is inserting data into one table, it was taking 15 min to complete before. Today it is taking more than 2 hours. What kind of action you will take?
-
DROP command and VIEW
How does dropping a table affects its view?
-
Remove redundant rows
How to remove redundant rows without any distinct columns in the table itself ?
-
How to retrieve uncommon fields from two different tables?
How can i retrieve uncommon fields from two different tables along with the data??? say i have table A and table B and Tbl A has x,y,z fields and Tbl B has x,a,b fields and i have to retrieve y,z,a,b fields from two tables along with the data.
-
Retrieve all columns except 1 in a table.
I have a table with 20 columns and I have to retrieve 19 except one.
Is there any way easier then giving
SELECT Col1,Col2,Col3,..........Col19 from table1. -
SQL Query to convert single row from multiple tables into single row in a table
I have a scenario like Have 7 tables. All these 7 tables have same metadata structure and also all have 2 columns. In that, One column is same in all 7 tables (Joining column, But not a primary column) and another column has different values.
Below have a example for 2 tables. How can we achieve for 7 tables?
Tab1
====
loc_name mem_name
HYD ... -
-
-
SubQuery Performace - IN clause or EXISTS clause
In subqueries, which is efficient ,the IN clause or EXISTS clause? Does they produce the same result?
-
-
What will be the output of the following query?
SELECT REPLACE(TRANSLATE(LTRIM(RTRIM('!! ATHEN !!','!'), '!'), 'AN', '**'),'*','TROUBLE') FROM DUAL;TROUBLETHETROUBLE
-
SQL Interview Questions
Ans