Database Testing Interview Questions By H2kInfosys


Published on

Check out our Database Testing Interview Questions which are useful for all students across the world.

Published in: Education
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Database Testing Interview Questions By H2kInfosys

  1. 1. Job Oriented – Instructor Led – Face2Face – True Live Online I.T. Training for Everyone Worldwide H2kInfosys H2K Infosys provides online IT training and placement services worldwide. USA- +1-(770)-777-1269, UK – (020) 3371 7615 / DISCLAIMER H2K Infosys, LLC (hereinafter “H2K”) acknowledges the proprietary rights of the trademarks and products names of other companies mentioned in any of the training material including but not limited to the handouts, written material, videos, power point presentations, etc. All such training materials are provided to H2K students for learning purposes only. H2K students shall not use such materials for their private gain nor can they sell any such materials to a third party. Some of the examples provided in any such training materials may not be owned by H2K and as such H2K does not claim any proprietary rights for the same. H2K does not guarantee nor is it responsible for such products and projects. H2K acknowledges that any such information or product that has been lawfully received from third party source is free from restriction and without any breach or violation of law whatsoever.
  2. 2. Job Oriented – Instructor Led – Face2Face – True Live Online I.T. Training for Everyone Worldwide Database Testing Interview Questions Q. 1: What we normally check for in the Database Testing? In Database Testing we need to check, 1) The field size validation 2) Check constraints. 3) Indexes are done or not (for performance related issues) 4) Stored procedures 5) The field size defined in the application is matching with that in the db. =================================================================== Q. 2: How can we do manual testing of database? Explain with an example It involves observing operations that are operated on front-end are effected on the back-end or not. The approach can be explained like: While adding a record through the front-end, check back-end that addition of record is effected or not. It applies to delete, update,......etc. For Example: Enter the employee record in database through the front-end and check manually if the record is added or not to the back-end. ========================================================================= Q. 3: While doing database testing, how do we know that a trigger is fired or not? It can be verified by querying the common audit log where we are able to see if the triggers is fired or not. =========================================================================== Q. 4: Is "A fast database retrieval rate" a testable requirement? No. Since the requirement seems to be ambiguous. The SRS should clearly mention the performance or transaction requirements i.e. It should specify clearly like - Database retrieval rate of 5 microseconds. ============================================================================== Q.5: What steps does a tester take in testing Stored Procedures? First the tester should to go through the requirement, as to why the particular stored procedure is written for.
  3. 3. Job Oriented – Instructor Led – Face2Face – True Live Online I.T. Training for Everyone Worldwide Then check whether all the required indexes, joins, updates, deletions are correct comparing with the tables mentioned in the Stored Procedure. And also he has to ensure whether the Stored Procedure follows the standard format like comments, updated by, etc. Then check the procedure calling name, calling parameters, and expected Reponses for different sets of input parameters. Then run the procedure yourself with database client programs like TOAD, or mysql, or Query Analyzer Rerun the procedure with different parameters, and check results against expected values. Finally, automate the tests with QTP. ============================================================================ Q. 6: What SQL statements have you used in Database Testing? -Both DDL and DML =========================================================================== Q. 7: What are the test scenarios to test a database migrated from SQL Server 2005 to SQL Server 2008? We need to check out what was all the enhancement the SQL Server 2008 has in it. We need to design our test case considering the following points. 1) Data type used 2) Length of the data field it should be same as it was in SQL 2005 3) All the jobs should be scheduled properly =========================================================================== Q. 8: What is primary key? Difference between Primary key and unique key -Primary Key: Can be only one in a table It never allows null values Primary Key is unique key identifier and can not be null and must be unique. -Unique Key: Can be more than one unique key in one table. Unique key can have null values It can’t be candidate key
  4. 4. Job Oriented – Instructor Led – Face2Face – True Live Online I.T. Training for Everyone Worldwide Unique key can be null and may not be unique. Q. 9: What are constrains? -NULL,primary key,unique key,foriegn key,check,default =============================================================================== Q. 10: Difference between DELETE, TRUNCATE AND DROP 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 Drop can only be used to delete the whole table ============================================================================== Q. 11: What is a stored procedure? -SET of SQL statements ============================================================================== Q. 12.What does the following query do: SELECT SAL+NVL(COMMN,0) FROM EMP -This displays the total salary of all employees. The null values in the commission column will be replaced by 0 and added to salary. ============================================================================== Q. 13.What is join? Explain different types of joins? Join is a query, which retrieves related columns or rows from multiple tables. Self Join - Joining the table with itself. Equi Join - Joining two tables by equating two common columns. Non-Equi Join - Joining two tables by equating two common columns. Outer Join - Joining two tables in such a way that query can also retrieve rows that do not have corresponding join value in the other table. =========================================================================== Q. 14.Difference between stored procedures and a function 1> Procedure can return zero or n values whereas function can return one value which is mandatory.
  5. 5. Job Oriented – Instructor Led – Face2Face – True Live Online I.T. Training for Everyone Worldwide 2>Procedures can have input,output parameters for it whereas functions can have only input parameters. 3>Procedure allow select as well as DML statement in it whereas function allow only select statement in it. 4>Functions can be called from procedure whereas procedures cannot be called from function. 5.functions can be used in select statement procedures cannot . ================================================================================ Q. 15. Describe how NULL works with SQL? ================================================================================ Q. 16 can a table have more than one foreign key defined -yes a table can more than one foreign key defined ================================================================================ Q. 17 which operator does you use to return all of the rows from one query except rows are returned in a second query? ================================================================================ Q. 18.Describe some group functions you know -These functions are: COUNT, MAX, MIN, AVG, SUM, DISTINCT ================================================================================ Q. 19. How will you update any column in a table UPDATE table_name SET column_name = new_value WHERE column_name = some_value ================================================================================ Q. 20.Difference between UNION AND JOINS - UNION - returns all distinct rows selected by either query -jOINS retrieves related columns or rows from multiple tables. ================================================================================ Q. do you add record to a table INSERT INTO table_name VALUES (value1, value2,....) INSERT INTO table_name (column1, column2,...) VALUES (value1, value2,....) ===============================================================================
  6. 6. Job Oriented – Instructor Led – Face2Face – True Live Online I.T. Training for Everyone Worldwide Q 22. What's Date Functions Date Functions are ADD_MONTHS, LAST_DAY, NEXT_DAY, MONTHS_BETWEEN & SYSDATE. ============================================================================== Q 23. What's Intersect Intersect is the product of two tables listing only the matching rows. =============================================================================== Q 24. Order of SQL statement execution Where clause, Group By clause, having clause, Order By clause & Select. =============================================================================== Q 25. Operators used in SELECT statements. = Equal <> or != Not equal > Greater than < Less than >= Greater than or equal <= Less than or equal Between an inclusive range LIKE Search for a pattern =============================================================================== Q 26.How can you use Delete Statement: DELETE FROM table_name WHERE column_name = some_value Delete All Rows: DELETE FROM table_name or DELETE * FROM table_name ============================================================================== Q .27.Why does the following command give a compilation error? DROP TABLE &TABLE_NAME; Variable names should start with an alphabet. Here the table name starts with an '&' symbol. ==============================================================================
  7. 7. Job Oriented – Instructor Led – Face2Face – True Live Online I.T. Training for Everyone Worldwide Q 28. State true or false. !=, <>, ^= all denote the same operation? True. ============================================================================== Q 29. 17. State true or false. EXISTS, SOME, ANY are operators in SQL? True. ============================================================================= Q.30. What is the value of comm and sal after executing the following query if the initial value of ‘sal’ is 10000 UPDATE EMP SET SAL = SAL + 1000, COMM = SAL*0.1;? sal = 11000, comm = 1000. ============================================================================= Q.31. What operator performs pattern matching? LIKE operator. ============================================================================ Q 32. What operator tests column for the absence of data? IS NULL operator. ============================================================================ Q 33.TRUNCATE TABLE EMP; DELETE FROM EMP; Will the outputs of the above two commands differ? Both will result in deleting all the rows in the table EMP.. =========================================================================== Q34. What are the wildcards used for pattern matching? _ for single character substitution and % for multi-character substitution. =========================================================================== Q 35.Write SQL SELECT query that returns the first and last name of each instructor, the Salary, and gives each of them a number. A. SELECT FirstName, LastName, Salary, ROWNUM FROM Instructors; =========================================================================
  8. 8. Job Oriented – Instructor Led – Face2Face – True Live Online I.T. Training for Everyone Worldwide Q 36.Is the WHERE clause must appear always before the GROUP BY clause in SQL SELECT ? A. Yes. The proper order for SQL SELECT clauses is: SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY. Only the SELECT and FROM clause are mandatory. ========================================================================== Q.37.Write a query to return top N rows Select Top 10 From tbl_name ============================================================================ Q 38.Select last N rows from the table Select Top 10 From tbl_name Order by PK DESC ============================================================================ Q 39.Describe some Group Functions that you know A. 1) The COUNT function tells you how many rows were in the result set. SELECT COUNT(*) FROM TESTING.QA 2) The AVG function tells you the average value of a numeric column. SELECT MAX(SALARY) FROM TESTING.QA 3) The MAX and MIN functions tell you the maximum and minimum value of a numeric column. SELECT MIN(SALARY) FROM TESTING.QA 4) The SUM function tells you the sum value of a numeric column. SELECT SUM(SALARY) FROM TESTING.QA =========================================================================== 40. How to get the count of employees with unique name from employee table: SELECT COUNT (DISTINCT name) FROM employee; ============================================================================ 41. While testing stored procedures what are the steps does a tester takes? The tester will check the standard format of the stored procedures and also it checks the fields are correct like updates, joins, indexes, deletions as mentioned in the stored procedure. ================================= || O || =======================================