Next Question is easy and the answer is easier however some of you may find it tricky. We have two tables both have just one column in it. INPUT: Tablename: TABLE1 & TABLE2 | Columnname: RDBMS1 & RDBMS2| Value: Teradata OUTPUT: Write a generic SQL code which should give required Result. Leave your answer as comment below.
So you think you know SQL well , try this SQL Test. We have a table which stores trains Source and Destination information. And the table sample data looks like below: SOURCE DESTINATION DISTANCE NDLS LKO 520 LKO NDLS 520 MUM BAN 700 BAN CHE 450 BAN MUM 700 MUM LKO 1200 Now the requirement is that we should have only one [SOURCE-DESTINATION / DESTINATION-SOURCE ] pair in the table. If we have repeating pairs like [NDLS-LKO] & [LKO-NDLS] then remove one entry. Similarly, [MUM-BAN] & [BAN-MUM] is repeated so one row should be deleted. The output should look like below where highlighted rows should be removed.
We have a table which holds the information about CUSTOMERS and the CONTACT NUMBER of the CUSTOMERS. So in table we have CUST_ID, CUST_NUMBER and CUST_OFF_NUMBER. For few CUSTOMERS, the NUMBER and OFFICE NUMBER is same and for few CUSTOMERS , NUMBER and OFFICE NUMBER is different. Below is the snapshot of the CUSTOMERS table: The requirement is to fetch output in two columns (CUST_ID, CUST_NUMBER) such that if the CUSTOMER has same CUST_NUMBER and CUST_OFF_NUMBER then only one row should be present for the CUSTOMER however if the CUST_NUMBER and CUST_OFF_NUMBER are different then two rows should be present ; one for CUST_ID,CUST_NUMBER and
We have an EmployeeSalary Table which holds information about Employee and the Salary which the Employee is getting in respective months. The table is holding the data for past six months. Below is the snapshot of the EMP_SAL table: Now we need to write an SQL Query which can retrieve the name of EMPLOYEES who have received more than INR 120,000 in total as their SAL in last six months. The answer as per the snapshot of the table is RAJ Can you write the correct query? Leave your SQL Query as comment below. There may be several ways of getting the desired output. You
We have an EmployeeSalary Table which holds information about Employee and the Salary which the Employee is getting in respective months. Below is the snapshot of the EMP_SAL table: Now we need to write an SQL Query which can retrieve EMPLOYEE ID,EMPLOYEE NAME, CURRENT MONTH, CURRENT MONTH SALARY and PREVIOUS MONTH SALARY of the EMPLOYEE. If the SALARY for any particular month is not available then it should be treated as ZERO. Below is the Output which is required from the SQL Query: Can you write the correct query? Leave your SQL Query as comment below. There may be several ways of getting the desired output.