Showing posts with label Oracle Latest Interview Questions. Show all posts
Showing posts with label Oracle Latest Interview Questions. Show all posts

Saturday, March 22, 2008

Oracle All Interview Questions and Answers

Free Latest and previous Oracle Interview Questions Resources:

Typical Oracle Questions - 7

Oracle PL, SQL, mysql interview questions - 6

Oracle Database Latest Interview Questions - 5

Oracle SQL Technical Interview Recent Questions - 4

Oracle DBA / DBMS post Interview Questions with Detailed Solutions - 3

Oracle Recent Database DBMS Interview 2008 Questions - 2

Oracle Interview Questions

Also See all Oracle All Recent and Previous Papers

Keep watching out for more Oracle Latest Interview Question Placement Papers for year 2007 and 2008 all months for leading companies infosys, wipro, ibm, microsoft, cisco, dell, ebay, sap, oracle, peoplesoft, hcl, quark, ramco, l.t, satyam computers, accenture, cognizant, T-Systems, IFlex, KPO, BPO companies, IT, ITES companies in India, uk, usa, us - phillipines, china, hungary Freshers Graduates Placement Jobs. See Previouspapers.blogspot.com

Typical Oracle Questions - 7

Typical Oracle questions

  1. Tell us about yourself, your background.

  2. What are the three major characteristics that you bring to this company?

  3. What version of Oracle were you running?

  4. How many databases did the organization have and what sizes?

  5. What motivates you to do a good job?

  6. What two or three things are most important to you at work?

  7. What qualities do you think are essential to be successful in this kind of work?

  8. What courses did you attend? What job certifications do you hold?

  9. What subjects/courses did you excel in? Why?

  10. What subjects/courses gave you trouble? Why?

  11. How does your previous work experience prepare you for this position?

  12. How do you define ’success’?

  13. What has been your most significant accomplishment to date?

  14. Describe a challenge you encountered and how you dealt with it.

  15. Describe a failure and how you dealt with it.

  16. Describe the ‘ideal’ job… the ‘ideal’ supervisor.

  17. What leadership roles have you held?

  18. What prejudices do you hold?

  19. What do you like to do in your spare time?

  20. What are your career goals (a) 3 years from now; (b) 10 years from now?

  21. How does this position match your career goals?

  22. What have you done in the past year to improve yourself?

  23. In what areas do you feel you need further education and training to be successful?

  24. What do you know about our company?

  25. Why do you want to work for this company. Why should we hire you?

  26. Where do you see yourself fitting in to this organization initially? How about in 5 years?

  27. Why are you looking for a new job?

  28. How do you feel about re-locating?

  29. Are you willing to travel?

  30. What are your salary requirements?

  31. When would you be available to start if you were selected?

  32. Did you use online or off-line backups?

  33. If you have to advise a backup strategy for a new application, how would you approach it and what questions will you ask?

  34. If a customer calls you about a hanging database session, what will you do to resolve it?

  35. Compare Oracle to any other database that you know. Why would you prefer to work on one and not on the other

Latest / Recent and Previous oracle interview questions with solutions and hr, tech interview topics and detailed explanation for your success in placement interview.. Good Luck! May u get placed in a reputed IT / ITES MNC. Keep watching out for more interview questions of different programming languages only on Previouspapers.blogspot.com

Oracle PL, SQL, mysql interview questions - 6

PL - SQL Questions

  1. Which of the following statements is true about implicit cursors?

    1. Implicit cursors are used for SQL statements that are not named.

    2. Developers should use implicit cursors with great care.

    3. Implicit cursors are used in cursor for loops to handle data processing.

    4. Implicit cursors are no longer a feature in Oracle.

  2. Which of the following is not a feature of a cursor FOR loop?

    1. Record type declaration.

    2. Opening and parsing of SQL statements.

    3. Fetches records from cursor.

    4. Requires exit condition to be defined.

  3. A developer would like to use referential datatype declaration on a variable. The variable name is EMPLOYEE_LASTNAME, and the corresponding table and column is EMPLOYEE, and LNAME, respectively. How would the developer define this variable using referential datatypes?

    1. Use employee.lname%type.

    2. Use employee.lname%rowtype.

    3. Look up datatype for EMPLOYEE column on LASTNAME table and use that.

    4. Declare it to be type LONG.

  4. Which three of the following are implicit cursor attributes?

    1. %found

    2. %too_many_rows

    3. %notfound

    4. %rowcount

    5. %rowtype

  5. If left out, which of the following would cause an infinite loop to occur in a simple loop?

    1. LOOP

    2. END LOOP

    3. IF-THEN

    4. EXIT

  6. Which line in the following statement will produce an error?

    1. cursor action_cursor is

    2. select name, rate, action

    3. into action_record

    4. from action_table;

    5. There are no errors in this statement.

  7. The command used to open a CURSOR FOR loop is

    1. open

    2. fetch

    3. parse

    4. None, cursor for loops handle cursor opening implicitly.

  8. What happens when rows are found using a FETCH statement

    1. It causes the cursor to close

    2. It causes the cursor to open

    3. It loads the current row values into variables

    4. It creates the variables to hold the current row values

  9. Read the following code:

    CREATE OR REPLACE PROCEDURE find_cpt
    (v_movie_id {Argument Mode} NUMBER, v_cost_per_ticket {argument mode} NUMBER)
    IS
    BEGIN
    IF v_cost_per_ticket > 8.5 THEN
    SELECT cost_per_ticket
    INTO v_cost_per_ticket
    FROM gross_receipt
    WHERE movie_id = v_movie_id;
    END IF;
    END;

    Which mode should be used for V_COST_PER_TICKET?

    1. IN

    2. OUT

    3. RETURN

    4. IN OUT

  10. Read the following code:

    CREATE OR REPLACE TRIGGER update_show_gross
    {trigger information}
    BEGIN
    {additional code}
    END;

    The trigger code should only execute when the column, COST_PER_TICKET, is greater than $3. Which trigger information will you add?

    1. WHEN (new.cost_per_ticket > 3.75)

    2. WHEN (:new.cost_per_ticket > 3.75

    3. WHERE (new.cost_per_ticket > 3.75)

    4. WHERE (:new.cost_per_ticket > 3.75)

  11. What is the maximum number of handlers processed before the PL/SQL block is exited when an exception occurs?

    1. Only one

    2. All that apply

    3. All referenced

    4. None

  12. For which trigger timing can you reference the NEW and OLD qualifiers?

    1. Statement and Row

    2. Statement only

    3. Row only

    4. Oracle Forms trigger

  13. Read the following code:

    CREATE OR REPLACE FUNCTION get_budget(v_studio_id IN NUMBER)
    RETURN number IS

    v_yearly_budget NUMBER;

    BEGIN
    SELECT yearly_budget
    INTO v_yearly_budget
    FROM studio
    WHERE id = v_studio_id;

    RETURN v_yearly_budget;
    END;

    Which set of statements will successfully invoke this function within SQL*Plus?

    1. VARIABLE g_yearly_budget NUMBER
      EXECUTE g_yearly_budget := GET_BUDGET(11);

    2. VARIABLE g_yearly_budget NUMBER
      EXECUTE :g_yearly_budget := GET_BUDGET(11);

    3. VARIABLE :g_yearly_budget NUMBER
      EXECUTE :g_yearly_budget := GET_BUDGET(11);

    4. VARIABLE g_yearly_budget NUMBER
      :g_yearly_budget := GET_BUDGET(11);

  14. CREATE OR REPLACE PROCEDURE update_theater
    (v_name IN VARCHAR v_theater_id IN NUMBER) IS
    BEGIN
    UPDATE theater
    SET name = v_name
    WHERE id = v_theater_id;
    END update_theater;

    When invoking this procedure, you encounter the error:

    ORA-000: Unique constraint(SCOTT.THEATER_NAME_UK) violated.

    How should you modify the function to handle this error?

    1. An user defined exception must be declared and associated with the error code and handled in the EXCEPTION section.

    2. Handle the error in EXCEPTION section by referencing the error code directly.

    3. Handle the error in the EXCEPTION section by referencing the UNIQUE_ERROR predefined exception.

    4. Check for success by checking the value of SQL%FOUND immediately after the UPDATE statement.

  15. Read the following code:

    CREATE OR REPLACE PROCEDURE calculate_budget IS
    v_budget studio.yearly_budget%TYPE;
    BEGIN
    v_budget := get_budget(11);
    IF v_budget <>

    You are about to add an argument to CALCULATE_BUDGET. What effect will this have?

    1. The GET_BUDGET function will be marked invalid and must be recompiled before the next execution.

    2. The SET_BUDGET function will be marked invalid and must be recompiled before the next execution.

    3. Only the CALCULATE_BUDGET procedure needs to be recompiled.

    4. All three procedures are marked invalid and must be recompiled.

  16. Which procedure can be used to create a customized error message?

    1. RAISE_ERROR

    2. SQLERRM

    3. RAISE_APPLICATION_ERROR

    4. RAISE_SERVER_ERROR

  17. The CHECK_THEATER trigger of the THEATER table has been disabled. Which command can you issue to enable this trigger?

    1. ALTER TRIGGER check_theater ENABLE;

    2. ENABLE TRIGGER check_theater;

    3. ALTER TABLE check_theater ENABLE check_theater;

    4. ENABLE check_theater;

  18. Examine this database trigger

    CREATE OR REPLACE TRIGGER prevent_gross_modification
    {additional trigger information}
    BEGIN
    IF TO_CHAR(sysdate, DY) = MON
    THEN
    RAISE_APPLICATION_ERROR(-20000,Gross receipts cannot be deleted on
     Monday);
    END IF;
    END;

    This trigger must fire before each DELETE of the GROSS_RECEIPT table. It should fire only once for the entire DELETE statement. What additional information must you add?

    1. BEFORE DELETE ON gross_receipt

    2. AFTER DELETE ON gross_receipt

    3. BEFORE (gross_receipt DELETE)

    4. FOR EACH ROW DELETED FROM gross_receipt

  19. Examine this function:

    CREATE OR REPLACE FUNCTION set_budget
    (v_studio_id IN NUMBER, v_new_budget IN NUMBER) IS
    BEGIN
    UPDATE studio
    SET yearly_budget = v_new_budget
    WHERE id = v_studio_id;

    IF SQL%FOUND THEN
    RETURN TRUEl;
    ELSE
    RETURN FALSE;
    END IF;

    COMMIT;
    END;

    Which code must be added to successfully compile this function?

    1. Add RETURN right before the IS keyword.

    2. Add RETURN number right before the IS keyword.

    3. Add RETURN boolean right after the IS keyword.

    4. Add RETURN boolean right before the IS keyword.

  20. Under which circumstance must you recompile the package body after recompiling the package specification?

    1. Altering the argument list of one of the package constructs

    2. Any change made to one of the package constructs

    3. Any SQL statement change made to one of the package constructs

    4. Removing a local variable from the DECLARE section of one of the package constructs

  21. Procedure and Functions are explicitly executed. This is different from a database trigger. When is a database trigger executed?

    1. When the transaction is committed

    2. During the data manipulation statement

    3. When an Oracle supplied package references the trigger

    4. During a data manipulation statement and when the transaction is committed

  22. Which Oracle supplied package can you use to output values and messages from database triggers, stored procedures and functions within SQL*Plus?

    1. DBMS_DISPLAY

    2. DBMS_OUTPUT

    3. DBMS_LIST

    4. DBMS_DESCRIBE

  23. What occurs if a procedure or function terminates with failure without being handled?

    1. Any DML statements issued by the construct are still pending and can be committed or rolled back.

    2. Any DML statements issued by the construct are committed

    3. Unless a GOTO statement is used to continue processing within the BEGIN section, the construct terminates.

    4. The construct rolls back any DML statements issued and returns the unhandled exception to the calling environment.

  24. Examine this code

    BEGIN
    theater_pck.v_total_seats_sold_overall := theater_pck.get_total_for_year;
    END;

    For this code to be successful, what must be true?

    1. Both the V_TOTAL_SEATS_SOLD_OVERALL variable and the GET_TOTAL_FOR_YEAR function must exist only in the body of the THEATER_PCK package.

    2. Only the GET_TOTAL_FOR_YEAR variable must exist in the specification of the THEATER_PCK package.

    3. Only the V_TOTAL_SEATS_SOLD_OVERALL variable must exist in the specification of the THEATER_PCK package.

    4. Both the V_TOTAL_SEATS_SOLD_OVERALL variable and the GET_TOTAL_FOR_YEAR function must exist in the specification of the THEATER_PCK package.

  25. A stored function must return a value based on conditions that are determined at runtime. Therefore, the SELECT statement cannot be hard-coded and must be created dynamically when the function is executed. Which Oracle supplied package will enable this feature?

    1. DBMS_DDL

    2. DBMS_DML

    3. DBMS_SYN

    4. DBMS_SQL

Oracle and Java Latest / Recent Placement Paper questions and answers for programming / technical paper for leading IT Companies Infosys, Wipro, IBM, CISCO, Oracle, SAP, TCS, Satyam Computers, HCL, Microsoft, Ramco, Cognizant, Verizon, Cingular, IFlex Solutions Landran Chandigarh, Mohali, Delhi, bangalore, chennai, hyderabad, pune, kolkata, latest interview question papers with complete solutions submitted by real candidates and answered by experts. Keep watching out for 2007, 2008 and recent papers for all months - january, februrary, march, april, may, june, july, august, september, october, november, december. Good luck for your papers!!


Oracle Database Latest Interview Questions - 5

Oracle interview questions

  1. What is an oracle instance?

  2. What is a view?

  3. What is referential integrity?

  4. Name the data dictionary that stores user-defined constraints?

  5. What is a collection of privileges?

  6. What is a snapshot?

  7. What is a synonym?

  8. What is a cursor?

  9. What is a sequence?

  10. What is a trigger?

  11. What is an exception?

  12. What is a partition of table?

  13. What are pseudo-columns in SQL? Provide examples.

  14. What are the Data Control statements?

  15. What is a schema?

  16. What is a type?

  17. What is a data model?

  18. What is a relation?

  19. Advantages of redo log files?

  20. What is an Archiver?

  21. What is a database buffer cache?

  22. What are the background processes in Oracle?

  23. %type and %rowtype are attributes for…?

  24. What are the steps in a two-phase commit?

  25. What is a union, intersect, minus?

  26. What is a join, explain the types of joins?

  27. What is a co-related sub-query?

  28. ODBC stands for…?

  29. Data-type used to work with integers is?

  30. Describe data models?

  31. Describe the Normalization principles?

  32. What are the types of Normalization?

  33. What is de-normalization?

Latest Oracle 2008 technical interview questions for leading IT MNCs Indian and US companies Interview Question Papers submitted by real interview candidates. Also see multiple choice questions MCQs of leading companies like Oracle, TCS, Infosys, Wipro, Satyam, Accenture, HCL, Microsoft, SAP, etc. online free here for 2008 and 2007 all months.. Good Luck for your placement papers!

Oracle SQL Technical Interview Recent Questions - 4

Oracle interview questions

  1. What’s the command to see the current user name? Sql> show user;

  2. What’s the command to change the SQL prompt name?

    SQL> set sqlprompt “database-1 > ”
    database-1 >
    database-1 >

  3. How do I eliminate duplicate rows in an Oracle database?

    SQL> delete from table_name where rowid not in (select max(rowid) from table group by duplicate_values_field_name);

    or

    SQL> delete duplicate_values_field_name dv from table_name ta where rowid < (select min(rowid) from table_name tb where ta.dv=tb.dv);

  4. How do I display row number with records? Use the row-num pseudocolumn with query, like

    SQL> select rownum, ename from emp;

  5. How do you display the records within a given range?

    select rownum, empno, ename from emp where rowid in
    (select rowid from emp where rownum < =&rangeend
    minus
    select rowid from emp where rownum<&rangebegin);

  6. The NVL function only allows the same data type. But here’s the task: if the commission field is null, then the text “Not Applicable” should be displayed, instead of blank space. How do you write the query?

    SQL> select nvl(to_char(comm.),’Not Applicable’) from emp;

  7. Explain explicit cursor attributes. There are four cursor attributes used in Oracle: cursor_name%Found, cursor_name%NOTFOUND, cursor_name%ROWCOUNT, cursor_name%ISOPEN

  8. Explain implicit cursor attributes. Same as explicit cursor but prefixed by the word SQL: SQL%Found, SQL%NOTFOUND, SQL%ROWCOUNT, SQL%ISOPEN

  9. How do you view version information in Oracle?

    SQL> select banner from $version;

10. How do you switch to DOS prompt from SQL prompt? SQL> host

See more latest Oracle Database, DBA, gaming database - graphics, GUI recent important questions mostly asked in common interview questions pre placement and GD topics. See Technical interview java questions commonly asked placement questions for top IT MNCs in India, USA, UK, Norway, China, UAE, Denmark, Hungary, etc.

Oracle DBA / DBMS post Interview Questions with Detailed Solutions - 3

Oracle DBA interview questions

  1. Explain the difference between a hot backup and a cold backup and the benefits associated with each. - A hot backup is basically taking a backup of the database while it is still up and running and it must be in archive log mode. A cold backup is taking a backup of the database while it is shut down and does not require being in archive log mode. The benefit of taking a hot backup is that the database is still available for use while the backup is occurring and you can recover the database to any point in time. The benefit of taking a cold backup is that it is typically easier to administer the backup and recovery process. In addition, since you are taking cold backups the database does not require being in archive log mode and thus there will be a slight performance gain as the database is not cutting archive logs to disk.

  2. You have just had to restore from backup and do not have any control files. How would you go about bringing up this database? - I would create a text based backup control file, stipulating where on disk all the data files where and then issue the recover command with the using backup control file clause.

  3. How do you switch from an init.ora file to a spfile? - Issue the create spfile from pfile command.

  4. Explain the difference between a data block, an extent and a segment. - A data block is the smallest unit of logical storage for a database object. As objects grow they take chunks of additional storage that are composed of contiguous data blocks. These groupings of contiguous data blocks are called extents. All the extents that an object takes when grouped together are considered the segment of the database object.

  5. Give two examples of how you might determine the structure of the table DEPT. - Use the describe command or use the dbms_metadata.get_ddl package.

  6. Where would you look for errors from the database engine? - In the alert log.

  7. Compare and contrast TRUNCATE and DELETE for a table. - Both the truncate and delete command have the desired outcome of getting rid of all the rows in a table. The difference between the two is that the truncate command is a DDL operation and just moves the high water mark and produces a now rollback. The delete command, on the other hand, is a DML operation, which will produce a rollback and thus take longer to complete.

  8. Give the reasoning behind using an index. - Faster access to data blocks in a table.

  9. Give the two types of tables involved in producing a star schema and the type of data they hold. - Fact tables and dimension tables. A fact table contains measurements while dimension tables will contain data that will help describe the fact tables.

  10. What type of index should you use on a fact table? - A Bitmap index.

  11. Give two examples of referential integrity constraints. - A primary key and a foreign key.

  12. A table is classified as a parent table and you want to drop and re-create it. How would you do this without affecting the children tables? - Disable the foreign key constraint to the parent, drop the table, re-create the table, enable the foreign key constraint.

  13. Explain the difference between ARCHIVELOG mode and NOARCHIVELOG mode and the benefits and disadvantages to each. - ARCHIVELOG mode is a mode that you can put the database in for creating a backup of all transactions that have occurred in the database so that you can recover to any point in time. NOARCHIVELOG mode is basically the absence of ARCHIVELOG mode and has the disadvantage of not being able to recover to any point in time. NOARCHIVELOG mode does have the advantage of not having to write transactions to an archive log and thus increases the performance of the database slightly.

  14. What command would you use to create a backup control file? - Alter database backup control file to trace.

  15. Give the stages of instance startup to a usable state where normal users may access it. - STARTUP NOMOUNT - Instance startup. STARTUP MOUNT - The database is mounted. STARTUP OPEN - The database is opened

  16. What column differentiates the V$ views to the GV$ views and how? - The INST_ID column which indicates the instance in a RAC environment the information came from.

  17. How would you go about generating an EXPLAIN plan? - Create a plan table with utlxplan.sql. Use the explain plan set statement_id = ‘tst1′ into plan_table for a SQL statement. Look at the explain plan with utlxplp.sql or utlxpls.sql

  18. How would you go about increasing the buffer cache hit ratio? - Use the buffer cache advisory over a given workload and then query the v$db_cache_advice table. If a change was necessary then I would use the alter system set db_cache_size command.

  19. Explain an ORA-01555 - You get this error when you get a snapshot too old within rollback. It can usually be solved by increasing the undo retention or increasing the size of rollbacks. You should also look at the logic involved in the application getting the error message.

  20. Explain the difference between $ORACLE_HOME and $ORACLE_BASE. - ORACLE_BASE is the root directory for oracle. ORACLE_HOME located beneath ORACLE_BASE is where the oracle products reside

Keep Watching out for more Placement papers and MNC IT Companies Interview Technical HR Questions with Answers only on Previouspapers.blogspot.com

Oracle Recent Database DBMS Interview 2008 Questions - 2

Interview questions for Oracle database administrator

  1. Differentiate between TRUNCATE and DELETE

  2. What is the maximum buffer size that can be specified using the DBMS_OUTPUT.ENABLE function?

  3. Can you use a commit statement within a database trigger?

  4. What is an UTL_FILE.What are different procedures and functions associated with it?

  5. Difference between database triggers and form triggers?

  6. What is OCI. What are its uses?

  7. What are ORACLE PRECOMPILERS?

  8. What is syntax for dropping a procedure and a function? Are these operations possible?

  9. Can a function take OUT parameters. If not why?

  10. Can the default values be assigned to actual parameters?

  11. What is difference between a formal and an actual parameter?

  12. What are different modes of parameters used in functions and procedures?

  13. Difference between procedure and function.

  14. Can cursor variables be stored in PL/SQL tables.If yes how. If not why?

  15. How do you pass cursor variables in PL/SQL?

  16. How do you open and close a cursor variable.Why it is required?

  17. What should be the return type for a cursor variable.Can we use a scalar data type as return type?

  18. What is use of a cursor variable? How it is defined?

  19. What WHERE CURRENT OF clause does in a cursor?

  20. Difference between NO DATA FOUND and %NOTFOUND

  21. What is a cursor for loop?

  22. What are cursor attributes?

  23. Difference between an implicit & an explicit cursor.

  24. What is a cursor?

  25. What is the purpose of a cluster?

  26. How do you find the numbert of rows in a Table ?

  27. Display the number value in Words?

  28. What is a pseudo column. Give some examples?

  29. How you will avoid your query from using indexes?

  30. What is a OUTER JOIN?

  31. Which is more faster - IN or EXISTS?

  32. When do you use WHERE clause and when do you use HAVING clause?

  33. There is a % sign in one field of a column. What will be the query to find it?

  34. What is difference between SUBSTR and INSTR?

  35. Which datatype is used for storing graphics and images?

  36. What is difference between SQL and SQL*PLUS?

  37. What is difference between UNIQUE and PRIMARY KEY constraints?

  38. What is difference between Rename and Alias?

  39. What are various joins used while writing SUBQUERIES

See latest Oracle Interview Questions for year 2008 and previous years questions asked in hr interviews and technical, programming placement papers of leading IT MNCs. See the oracle database questions for 2007, 2008 papers and detailed interview questions with solutions. See the questions of january, february, march, april, may, june, july, august, september, october, november, december 2007 and 2008 for free online sorted by categories... Various companies papers like infosys, wipro, tcs, hcl, cisco, microsoft, ibm, sap, satyam computers, patni, mastek, ramco systems, cognizant, cap gemini, accenture, etc. are provided here.. also gaming related questions are given here in detail related to graphic design and website database real SQL questions and open source related questions.. keep watching

Oracle Interview Questions 1

SQL Interview Questions

1.What is SQL?

SQL stands for 'Structured Query Language'.

2.What is SELECT statement?

The SELECT statement lets you select a set of values from a table in a database. The values selected from the database table would depend on the various conditions that are specified in the SQL query.

3.How can you compare a part of the name rather than the entire name?

SELECT * FROM people WHERE empname LIKE '%ab%'
Would return a recordset with records consisting empname the sequence 'ab' in empname .

4.What is the INSERT statement?

The INSERT statement lets you insert information into a database.

5.How do you delete a record from a database?

Use the DELETE statement to remove records or any particular column values from a database.

6.How could I get distinct entries from a table?

The SELECT statement in conjunction with DISTINCT lets you select a set of distinct values from a table in a database. The values selected from the database table would of course depend on the various conditions that are specified in the SQL query. Example
SELECT DISTINCT empname FROM emptable

7.How to get the results of a Query sorted in any order?

You can sort the results and return the sorted results to your program by using ORDER BY keyword thus saving you the pain of carrying out the sorting yourself. The ORDER BY keyword is used for sorting.

SELECT empname, age, city FROM emptable ORDER BY empname

8.How can I find the total number of records in a table?

You could use the COUNT keyword , example
SELECT COUNT(*) FROM emp WHERE age>40

9.What is GROUP BY?

The GROUP BY keywords have been added to SQL because aggregate functions (like SUM) return the aggregate of all column values every time they are called. Without the GROUP BY functionality, finding the sum for each individual group of column values was not possible.

10.What is the difference among "dropping a table", "truncating a table" and "deleting all records" from a table.

Dropping : (Table structure + Data are deleted), Invalidates the dependent objects ,Drops the indexes

Truncating: (Data alone deleted), Performs an automatic commit, Faster than delete

Delete : (Data alone deleted), Doesn?t perform automatic commit

What are the Large object types suported by Oracle?

Blob and Clob.

11.Difference between a "where" clause and a "having" clause.

Having clause is used only with group functions whereas Where is not used with.

12.What's the difference between a primary key and a unique key?

Both primary key and unique enforce uniqueness of the column on which they are defined. But by default primary key creates a clustered index on the column, where are unique creates a nonclustered index by default. Another major difference is that, primary key doesn't allow NULLs, but unique key allows one NULL only.

13.What are cursors? Explain different types of cursors. What are the disadvantages of cursors? How can you avoid cursors?

Cursors allow row-by-row prcessing of the resultsets.

Types of cursors: Static, Dynamic, Forward-only, Keyset-driven. See books online for more information.

Disadvantages of cursors: Each time you fetch a row from the cursor, it results in a network roundtrip, where as a normal SELECT query makes only one rowundtrip, however large the resultset is. Cursors are also costly because they require more resources and temporary storage (results in more IO operations). Furthere, there are restrictions on the SELECT statements that can be used with some types of cursors.

Most of the times, set based operations can be used instead of cursors.

14.What are triggers? How to invoke a trigger on demand?

Triggers are special kind of stored procedures that get executed automatically when an INSERT, UPDATE or DELETE operation takes place on a table.

Triggers can't be invoked on demand. They get triggered only when an associated action (INSERT, UPDATE, DELETE) happens on the table on which they are defined.

Triggers are generally used to implement business rules, auditing. Triggers can also be used to extend the referential integrity checks, but wherever possible, use constraints for this purpose, instead of triggers, as constraints are much faster.

15.What is a join and explain different types of joins.

Joins are used in queries to explain how different tables are related. Joins also let you select data from a table depending upon data from another table.

Types of joins: INNER JOINs, OUTER JOINs, CROSS JOINs. OUTER JOINs are further classified as LEFT OUTER JOINS, RIGHT OUTER JOINS and FULL OUTER JOINS.

16.What is a self join?

Self join is just like any other join, except that two instances of the same table will be joined in the query