-
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 ... -
What is the use of DESC in SQL?
Answer :DESC has two purposes. It is used to describe a schema as well as to retrieve rows from table in descending order.Explanation : The query SELECT * FROM EMP ORDER BY ENAME DESC will display the output sorted on ENAME in descending order.
-
What is the output of the following query?
SELECT TRUNC(1234.5678,-2) FROM DUAL;1200
-
What operator performs pattern matching?
LIKE operator
-
What is the difference between TRUNCATE and DELETE commands?
TRUNCATE is a DDL command whereas DELETE is a DML command. Hence DELETE operation can be rolled back, but TRUNCATE operation cannot be rolled back. WHERE clause can be used with DELETE and not with TRUNCATE.
-
-
-
-
-
-
-
-
-
-
There is a Eno & gender in a table. Eno has primary key and gender has a check constraints for the values 'M' and 'F'. While inserting the data into the table M was misspelled as F and F as M. What is the update statement to replace F with M and M with F?
CREATE TABLE temp(eno NUMBER CONSTRAINTS pk_eno PRIMARY KEY,gender CHAR(1) CHECK (gender IN( 'M','F')));INSERT INTO temp VALUES ('01','M');INSERT INTO temp VALUES ('02','M');INSERT INTO temp VALUES ('03','F');INSERT INTO temp VALUES ('04','M');INSERT INTO temp VALUES ('05','M');INSERT INTO temp VALUES ('06','F');INSERT INTO temp VALUES ('07','M');INSERT INTO temp VALUES ('08','F');COMMIT;UPDATE temp...
-
SQL Interview Questions
Ans