DB2 Questions   «Prev  Next»

Database 10 Interview Questions

  1. Question:What is SQL?
    Answer: SQL stands for 'Structured Query Language
  2. Question:What is SELECT statement?
    Answer: The SELECT statement lets you select a set of values from a table in a database. The values selectedvfrom the database table would depend on the various conditions that are specified in the SQL query.
  3. Question: How can you compare a part of the name rather than the entire name?
    SELECT * FROM people WHERE empname LIKE '%ab%' 
  4. Question: What is the INSERT statement?
    Answer: The INSERT statement lets you insert information into a database.
  5. Question: How do you delete a record from a database? Answer: Use the DELETE statement to remove records or any particular column values from a database.
  6. Question: How could I get distinct entries from a table?
    Answer: 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.
    SELECT DISTINCT empname FROM emptable
  7. Question: How to get the results of a Query sorted in any order?
    Answer: 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. Question: How can I find the total number of records in a table?
    Answer: You could use the COUNT keyword , example
    SELECT COUNT(*) FROM emp WHERE age>40
  9. Question:What is GROUP BY? Answer: 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. Question: What is the difference among "dropping a table", "truncating a table" and "deleting all records" from a table
    1. Dropping:(Table structure  + Data are deleted), Invalidates the dependent objects Drops the indexes
    2. Truncating: (Data alone deleted), Performs an automatic commit, Faster than delete
    3. Delete: (Data alone deleted), Does not perform automatic commit