| How would you find out the total number of rows in a table? | 
| Use SELECT COUNT(*) ... in query | 
| How do you eliminate duplicate values in SELECT ? | 
| Use SELECT DISTINCT ... in SQL query | 
| How you insert records into a table | 
| Using SQL INSERT statement | 
| How do you delete record from a table ? | 
| Using DELETE statement | 
| How do you select a row using indexes? | 
| Specify the indexed columns in the WHERE clause of query. | 
| How do you find the maximum value in a column? | 
| Use SELECT MAX(...) .. in query | 
| How do you retrieve the first 5 characters of FIRSTNAME column of table EMP ? | 
| SELECT SUBSTR(FIRSTNAME,1,5) FROM EMP | 
| My SQL statement SELECT AVG(SALARY) FROM EMP yields inaccurate results. Why? | 
| Because SALARY is not declared to have NULLs and the employees for whom the | 
| How do you concatenate the FIRSTNAME and LASTNAME from EMP table to give a complete name? | 
| SELECT FIRSTNAME || ‘ ‘ || LASTNAME FROM EMP | 
| What is UNION,UNION ALL in SQL? | 
| UNION : eliminates duplicates | 
| Suppose I have five SQL SELECT statements connected by UNION/UNION ALL, how many times should I specify UNION to eliminate the duplicate rows? | 
| Once. | 
| In the WHERE clause what is BETWEEN and IN? | 
| BETWEEN supplies a range of values while IN supplies a list of values. | 
| Is BETWEEN inclusive of the range values specified? | 
| Yes. | 
| What is 'LIKE' used for in WHERE clause? What are the wildcard characters? | 
| LIKE is used for partial string matches. ‘%’ ( for a string of any character ) | 
| When do you use a LIKE statement? | 
| To do partial search e.g. to search employee by name, you need not specify | 
| What do you accomplish by GROUP BY ... HAVING clause? | 
| GROUP BY partitions the selected rows on the distinct values of the column on | 
| Consider the employee table with column PROJECT nullable. How can you get a list of employees who are not assigned to any project? | 
| SQL : SELECT EMPNO | 
| What are the large objects supported by oracle and db2? | 
| Blob , Clob ( Binary Large Objects, Character Large Objects) | 
| What's the difference between a primary key and a unique key? | 
| Primary key wont allow nulls, unique key allow nulls. | 
| What is a join and explain different types of joins? | 
| INNER JOIN | 
| What is a self join? | 
| Joining two instances of a same table. | 
| What is a transaction and ACID? | 
| Transaction - A transaction is a logicl unint of work. All steps must be commited or rolled back. | 
| Materialized Query Tables in db2 ( This feature might not be available in oracle) ? | 
| Materialized Query Tables or MQTs are also known as automatic summary | 
Tuesday, August 12, 2008
SQL Interview Questions, Explanation of statements SELECT ,INSERT, LIKE etc...
Labels:
SQL Interview Questions
Subscribe to:
Post Comments (Atom)
 
No comments:
Post a Comment