Database management interview questions

1. What is a Cartesian product? What causes it?

Expected answer:
A Cartesian product is the result of an unrestricted join of two or more tables. The result set of a three table Cartesian product will have x * y * z number of rows where x, y, z correspond to the number of rows in each table involved in the join. It is causes by specifying a table in the FROM clause without joining it to another table.

2. What is an advantage to using a stored procedure as opposed to passing an SQL query from an application.

Expected answer:
A stored procedure is pre-loaded in memory for faster execution. It allows the DBMS control of permissions for security purposes. It also eliminates the need to recompile components when minor changes occur to the database.

3. What is the difference of a LEFT JOIN and an INNER JOIN statement?

Expected answer:
A LEFT JOIN will take ALL values from the first declared table and matching values from the second declared table based on the column the join has been declared on. An INNER JOIN will take only matching values from both tables

4. When a query is sent to the database and an index is not being used, what type of execution is taking place?

Expected answer:
A table scan.

5. What are the pros and cons of using triggers?

Expected answer:
A trigger is one or more statements of SQL that are being executed in event of data modification in a table to which the trigger belongs.

Triggers enhance the security, efficiency, and standardization of databases.
Triggers can be beneficial when used:
– to check or modify values before they are actually updated or inserted in the database. This is useful if you need to transform data from the way the user sees it to some internal database format.
– to run other non-database operations coded in user-defined functions
– to update data in other tables. This is useful for maintaining relationships between data or in keeping audit trail information.
– to check against other data in the table or in other tables. This is useful to ensure data integrity when referential integrity constraints aren’t appropriate, or when table check constraints limit checking to the current table only.

6. What are the pros and cons of using stored procedures. When would you use them?

7. What are the pros and cons of using cursors? When would you use them?

This entry was posted in Database. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

14 Comments on Database management interview questions

  1. Chandra Sekhar
    Posted 1/6/2004 at 10:24 pm | Permalink

    Need Info Regarding Mainframe questions

  2. Nilavan
    Posted 3/25/2004 at 8:19 am | Permalink

    If u add performance tuning questions it’ll helpful

  3. Sethu
    Posted 4/20/2004 at 4:32 am | Permalink

    give some sybase specific Q&A

  4. Vimal Negi
    Posted 4/29/2004 at 2:43 am | Permalink

    IT’s an nice site for learning and to prepared for your techinical interview

  5. niaz
    Posted 5/16/2004 at 5:53 am | Permalink

    Hi,
    it would be helpful if you could include some interview questions regarding java and silk testing. If you know where i can find it, please let me know.

  6. bhushan
    Posted 5/17/2004 at 10:18 am | Permalink

    adding sybase interview questions to your database would help some.

  7. vamsi
    Posted 5/18/2004 at 12:26 pm | Permalink

    do u have more questions on SQL server… i tried the “read all questions” link…. it is bringing me back to the same page…Thanks

  8. Ravi
    Posted 7/14/2004 at 2:43 pm | Permalink

    Hi

    Can any one tell - difference between macro kernel and micro kernel
    it’s urgent - please reply soon

  9. Bino
    Posted 7/17/2004 at 11:21 pm | Permalink

    Can anybody pls tell me how to run a program in a client in which database in SQL Server,where we need not change the server name database name etc…

  10. rustic
    Posted 4/7/2005 at 11:17 am | Permalink

    Could any one forward few interview questions on sybase development and C++ with sybase.

  11. Kausik Mitra
    Posted 6/17/2005 at 3:31 am | Permalink

    I just had two questions.
    1.Database is hung. Old and new user connections alike hang on impact. What do you do? Your SYS SQLPLUS session IS able to connect.
    2.How many memory layers are in the shared pool?

  12. pankaj
    Posted 8/5/2005 at 12:58 am | Permalink

    Give me a SQL statement for finding the first three top studens from the gradesheet.

  13. prakashm
    Posted 6/7/2007 at 12:09 am | Permalink

    hi everybody

    can any tell what is normalization ? And various forms of normalization ?

  14. Upiter
    Posted 4/15/2008 at 3:23 pm | Permalink

    Normalization is process of organizing date in datebase. It includes creating tables and the relationships according the rules(forms,steps) to avoid two bad factors repeating information and non existed dependency.
    there are 5 main forms, but mostly we stop on 3. Fiest form or step is - primary key, no repeating atributes( customer1, customer2.) al set of incormation must be in dif tables. 2 step - foreing keys, all not key attributes must depend only from primary key 3 form - there must not be the situation when one non key depend from another non key But we have to look carefully , if the info not gonna change often it might be better to let it be here in one table.Well, all was in short words.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*