SlideShare a Scribd company logo
1 of 6
Q.What is Database testing ?
Testing the backend databases like comparing the actual results with expected results.
Q. What we test in database testing
Data bas testing basically include the following.
1)Data validity testing.
2)Data Integrity testing
3)Performance related to database.
4)Testing of Procedure, triggers and functions.
For doing data validity testing you should be good in SQL queries
For data integrity testing you should know about referential integrity and different constraint.
For performance related things you should have idea about the table structure and design.
For testing Procedure triggers and functions you should be able to understand the same.
Q.What are the different stages involved in Database Testing?
In DB testing we need to check for,
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.What SQL statements have you used in Database Testing?
DDL
DDL is Data Definition Language statements. Some examples: • CREATE • ALTER - • DROP -• TRUNCATE -• COMMENT - • RENAME –
DML
DML is Data Manipulation Language statements. Some examples: • SELECT - • INSERT - • UPDATE - • DELETE - • MERGE - UPSERT -•
CALL - • EXPLAIN PLAN - • LOCK TABLE –
DCL
DCL is Data Control Language statements. Some examples: • GRANT - • REVOKE - • COMMIT - • SAVEPOINT - • ROLLBACK - COMMIT
-• SET TRANSACTION - This are the Database testing commands.
Q.What is a Primary Key?
A primary key is a single column or multiple columns defined to have unique values that can be used as row identifications
Q.What is a Foreign Key?
A foreign key is a single column or a multiple columns defined to have values that can be mapped to a primary key in another table.
Q.What we normally check for in the Database Testing?
Database testing involves some in-depth knowledge of the given application and requires more defined plan of approach to test the
data. Key issues include:
1)data Integrity
2)data validity
3)data manipulation and updates.
Tester must be aware of the database design concepts and implementation rules
Q.How to Test database in Manually? Explain with an example
Observing that operations, which are operated on front-end is effected on back-end or not.
The approach is as follows:
While adding a record thru' front-end check back-end that addition of record is effected or not.
So same for delete, update...
Ex: Enter employee record in database thru' front-end and check if the record is added or not to the back-end (manually).
Q.What is an Index?
An index is a single column or multiple columns defined to have values pre-sorted to speed up data retrieval speed.
Q.What are NULL values?
NULL represents no value
NULL is not the same as an empty string ‘’
NULL is not same as zero value (0)
NULL can be used as any data type
NULL should not be used in any comparison operators
NULL has its own equality operator IS and not-equality operator IS NOT
Q.What is the difference between oracle, sql and sql server ?
•Oracle is based on RDBMS.
•SQL is Structured Query Language.
•SQL Server is another tool for RDBMS provided by MicroSoft.
Q.Why you need indexing? where that is Stored and what you mean by schema object? For what purpose we are using view?
We can't create an Index on Index.. Index is stoed in user_index table. Every object that has been created on Schema is Schema
Object like Table, View etc. If we want to share the particular data to various users we have to use the virtual table for the Base
table. So that is a view.
Indexing is used for faster search or to retrieve data faster from various table. Schema containing set of tables, basically schema
means logical separation of the database. View is crated for faster retrieval of data. It's customized virtual table. we can create a
single view of multiple tables. Only the drawback is..view needs to be get refreshed for retrieving updated data.
Q.What is the difference between TRUNCATE and DELETE commands?
•Both will result in deleting all the rows in the table .TRUNCATE call cannot be rolled back as it is a DDL command and all memory
space for that table is released back to the server. TRUNCATE is much faster.Whereas DELETE call is an DML command and can be
rolled back.
Q.Which system table contains information on constraints on all the tables created ?
USER_CONSTRAINTS,
system table contains information on constraints on all the tables created
Q.what operator performs pattern matching?
Pattern matching operator is LIKE and it has to used with two attributes
1.% means matches zero or more characters and
2._( underscore ) means matching exactly one character
Q.What is cluster.cluster index and non cluster index ?
Clustered Index:- A Clustered index is a special type of index that reorders the way records in the table are physically stored.
Therefore table may have only one clustered index.Non-Clustered Index:- A Non-Clustered index is a special type of index in which
the logical order of the index does not match the physical stored order of the rows in the disk. The leaf nodes of a non-clustered
index does not consists of the data pages. instead the leaf node contains index rows.
Q.What is GROUP BY?
The GROUP BY keywords has 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.
Q.What are defaults? Is there a column to which a default can't be bound?
A default is a value that will be used by a column, if no value is supplied to that column while inserting data. IDENTITY columns and
timestamp columns can't have defaults bound to them.
Q.What is an extended stored procedure? Can you instantiate a COM object by using T-SQL?
An extended stored procedure is a function within a DLL (written in a programming language like C, C++ using Open Data Services
(ODS) API) that can be called from T-SQL, just the way we call normal stored procedures using the EXEC statement. See books online
to learn how to create extended stored procedures and how to add them to SQL Server. You can instantiate a COM (written in
languages like VB, VC++) object from T-SQL by using sp_OACreate stored procedure.
Q.What is Trigger?
A trigger is a SQL procedure that initiates an action when an event (INSERT, DELETE or UPDATE) occurs. Triggers are stored in and
managed by the DBMS. Triggers are used to maintain the referential integrity of data by changing the data in a systematic fashion. A
trigger cannot be called or executed; DBMS automatically fires the trigger as a result of a data modification to the associated table.
Triggers can be viewed as similar to stored procedures in that both consist of procedural logic that is stored at the database level.
Stored procedures, however, are not event-drive and are not attached to a specific table as triggers are. Stored procedures are
explicitly executed by invoking a CALL to the procedure while triggers are implicitly executed. In addition, triggers can also execute
stored procedures.
Q.What is User Defined Functions? What kind of User-Defined Functions can be created?
User-Defined Functions allow defining its own T-SQL functions that can accept 0 or more parameters and return a single scalar data
value or a table data type.
Different Kinds of User-Defined Functions created are:
1.Scalar User-Defined Function A Scalar user-defined function returns one of the scalar data types. Text, ntext, image and
timestamp data types are not supported. These are the type of user-defined functions that most developers are used to in other
programming languages. You pass in 0 to many parameters and you get a return value.
2.Inline Table-Value User-Defined Function An Inline Table-Value user-defined function returns a table data type and is an
exceptional alternative to a view as the user-defined function can pass parameters into a T-SQL select command and in essence
provide us with a parameterized, non-updateable view of the underlying tables.
3.Multi-statement Table-Value User-Defined Function A Multi-Statement Table-Value user-defined function returns a table and is
also an exceptional alternative to a view as the function can support multiple T-SQL statements to build the final result where the
view is limited to a single SELECT statement. Also, the ability to pass parameters into a TSQL select command or a group of them
gives us the capability to in essence create a parameterized, non-updateable view of the data in the underlying tables. Within the
create function command you must define the table structure that is being returned. After creating this type of user-defined
function, It can be used in the FROM clause of a T-SQL command unlike the behavior found when using a stored procedure which
can also return record sets
Q.What is Identity?
Identity (or AutoNumber) is a column that automatically generates numeric values. A start and increment value can be set, but most
DBA leave these at 1. A GUID column also generates numbers; the value of this cannot be controlled. Identity/GUID columns do not
need to be indexed.
Q.What is blocking and how would you troubleshoot it?
Blocking happens when one connection from an application holds a lock and a second connection requires a conflicting lock type.
This forces the second connection to wait, blocked on the first.
Q.Determine the name sex and age of the oldest student.
SELECT Name, Gender, (CURRENT_DATE-Dtnaiss)/365 AS Age
FROM Student
WHERE (CURRENT_DATE-Dtnaiss) /365 =
( SELECT MAX(( CURRENT_DATE-Dtnaiss) /365) FROM Student);
Q.Common SQL Syntax used in database interaction
a.Select Statement
SELECT "column_name" FROM "table_name"
b.Distinct
SELECT DISTINCT "column_name" FROM "table_name"
c.Where
SELECT "column_name" FROM "table_name" WHERE "condition"
d.And/Or
SELECT "column_name" FROM "table_name" WHERE "simple condition" {[AND|OR] "simple condition"}+
e.In
SELECT "column_name" FROM "table_name" WHERE "column_name" IN ('value1', 'value2', ...)
f.Between
SELECT "column_name" FROM "table_name" WHERE "column_name" BETWEEN 'value1' AND 'value2'
g.Like
SELECT "column_name" FROM "table_name" WHERE "column_name" LIKE {PATTERN}
h.Order By
SELECT "column_name" FROM "table_name" [WHERE "condition"] ORDER BY "column_name" [ASC, DESC]
i.Count
SELECT COUNT("column_name") FROM "table_name"
j.Group By
SELECT "column_name1", SUM("column_name2") FROM "table_name" GROUP BY "column_name1"
k.Having
SELECT "column_name1", SUM("column_name2") FROM "table_name" GROUP BY "column_name1" HAVING (arithematic function
condition)
l.Create Table Statement
CREATE TABLE "table_name" ("column 1" "data_type_for_column_1","column 2" "data_type_for_column_2",…)
m.Drop Table Statement
DROP TABLE "table_name"
n.Truncate Table Statement
TRUNCATE TABLE "table_name"
m.Insert Into Statement
INSERT INTO "table_name" ("column1", "column2", ...) VALUES ("value1", "value2", ...)
o.Update Statement
UPDATE "table_name" SET "column_1" = [new value] WHERE {condition}
p.Delete From Statement
DELETE FROM "table_name" WHERE {condition}
Q.SQL CREATE VIEW Syntax
CREATE VIEW view_name AS
SELECT column_name(s)
FROM table_name
WHERE condition
Q.How to find out the 10th highest salary in SQL query?
Table - Tbl_Test_Salary
Column - int_salary
select max(int_salary)
from Tbl_Test_Salary
where int_salary in(select top 10 int_Salary from Tbl_Test_Salary order by int_salary)
Q.How to test a SQL Query in WinRunner? With out using Database Checkpoints?
By writing scripting procedure in the TCL we can connect to the database and we can test database and queries.
Q.How does you test whether a database in updated when information is entered in the front end?
With database check point only in WinRunner, but in manual we will go to front end using some information. Will get some session
names using that session names we search in backend. If that information is correct then we will see query results.
Q.Write a query to find the 5th details from a table
SELECT column_name FROM table_name WHERE auto_incremented_id=
(SELECT TOP 1 auto_incremented_id FROM
(SELECT TOP 3 auto_incremented_id FROM employee ORDER BY auto_incremented_id ASC)
table_name ORDER BY auto_incremented_id DESC);
Q.Write a Query to display the Top N rows ?
MySQL
SELECT column_name FROM table_name
LIMIT number
SQL Server
SELECT TOP number/percent column_name FROM table_name
Oracle
SELECT column_name FROM table_name
WHERE ROWNUM<= number
Q.Difference between Stored Procedure and Trigger?
•we can call stored procedure explicitly.
•but trigger is automatically invoked when the action defined in trigger is done.
ex: create trigger after Insert on
•this trigger invoked after we insert something on that table.
•Stored procedure can't be inactive but trigger can be Inactive.
•Triggers are used to initiate a particular activity after fulfilling certain condition.It need to define and can be enable and disable
according to need.
Q.What is the advantage to use trigger in your PL?
A trigger is a database object directly associated with a particular table. It fires whenever a specific statement/type of statement is
issued against that table. The types of statements are insert,update,delete and query statements. Basically, trigger is a set of SQL
statements A trigger is a solution to the restrictions of a constraint. For instance: 1.A database column cannot carry PSEUDO
columns as criteria where a trigger can. 2. A database constraint cannot refer old and new values for a row where a trigger can.
Triggers are fired implicitly on the tables/views on which they are created. There are various advantages of using a trigger. Some of
them are:
•Suppose we need to validate a DML statement(insert/Update/Delete) that modifies a table then we can write a trigger on the table
that gets fired implicitly whenever DML statement is executed on that table.
•Another reason of using triggers can be for automatic updation of one or more tables whenever a DML/DDL statement is executed
for the table on which the trigger is created.
•Triggers can be used to enforce constraints. For eg : Any insert/update/ Delete statements should not be allowed on a particular
table after office hours. For enforcing this constraint Triggers should be used.
•Triggers can be used to publish information about database events to subscribers. Database event can be a system event like
Database startup or shutdown or it can be a user even like User loggin in or user logoff.
Q.What are the tradeoffs with having indexes?
1.Faster selects, slower updates.
2.Extra storage space to store indexes. Updates are slower because in addition to updating the table you have to update the index.
Q.What is "normalization"? "Denormalization"? Why do you sometimes want to denormalize?
Normalizing data means eliminating redundant information from a table and organizing the data so that future changes to the table
are easier.
Denormalization means allowing redundancy in a table. The main benefit of denormalization is improved performance with
simplified data retrieval and manipulation. This is done by reduction in the number of joins needed for data processing.
Q.What is a "constraint"?
A constraint allows you to apply simple referential integrity checks to a table. There are four primary types of constraints
PRIMARY/UNIQUE - enforces uniqueness of a particular table column. But by default primary key creates a clustered index on the
column, where are unique creates a non-clustered index by default. Another major difference is that, primary key doesn't allow
NULLs, but unique key allows one NULL only DEFAULT - specifies a default value for a column in case an insert operation does not
provide one. FOREIGN KEY - validates that every value in a column exists in a column of another table. CHECK - checks that every
value stored in a column is in some specified list. Each type of constraint performs a specific type of action. Default is not a
constraint. NOT NULL is one more constraint which does not allow values in the specific column to be null. And also it the only
constraint which is not a table level constraint.
Q.What is the system function to get the current user's details such as userid etc. ?
USER
USER_ID
USER_NAME
CURRENT_USER
SUSER_SID
HOST_NAME
SYSTEM_USER
SESSION_USER
Q.What is Stored Procedure?
A stored procedure is a named group of SQL statements that have been previously created and stored in the server database. Stored
procedures accept input parameters so that a single procedure can be used over the network by several clients using different input
data. And when the procedure is modified, all clients automatically get the new version. Stored procedures reduce network traffic
and improve performance. Stored procedures can be used to help ensure the integrity of the database.
Q.What are the different isolation levels ?
An isolation level determines the degree of isolation of data between concurrent transactions. The default SQL Server isolation level
is Read Committed. Here are the other isolation levels (in the ascending order of isolation): Read Uncommitted, Read Committed,
Repeatable Read, Serializable.
Q.What would happen if you create an index on each column of a table ?
If you create an index on each column of a table, it improves the query performance, as the query optimizer tool of the Database
engine can choose from all the existing indexes to come up with an efficient execution plan. At the same time, data modification
operations (such as INSERT, UPDATE, DELETE) will become slow, as every time data changes in the table, all the indexes need to be
updated. Another disadvantage is that, indexes need disk space, the more indexes you have, more disk space is used.
Q.The SQL statement to find the departments that have employees with a salary higher than the average employee salary
SELECT name FROM dept
WHERE id IN
(
SELECT dept_id FROM emp
WHERE sal>
(SELECT avg(sal)FROM emp)
)
Q.Write the SQL to use a sub query which will not return any rows - when just the table structure is required and not any of the
data.
CREATE TABLE new_table AS
SELECT * from table_orig WHERE 1=0;
The sub query returns no data but does return the column names and data types to the 'create table' statement.

More Related Content

What's hot

Automated Testing with Databases
Automated Testing with DatabasesAutomated Testing with Databases
Automated Testing with Databaseselliando dias
 
Process management seminar
Process management seminarProcess management seminar
Process management seminarapurva_naik
 
A-Project Report- SSIS
A-Project Report- SSISA-Project Report- SSIS
A-Project Report- SSISYubaraj Khanal
 
data stage-material
data stage-materialdata stage-material
data stage-materialRajesh Kv
 
Effective Test Driven Database Development
Effective Test Driven Database DevelopmentEffective Test Driven Database Development
Effective Test Driven Database Developmentelliando dias
 
Cts informatica interview question answers
Cts informatica interview question answersCts informatica interview question answers
Cts informatica interview question answersSweta Singh
 
UEMB270: Software Distribution Under The Hood
UEMB270: Software Distribution Under The HoodUEMB270: Software Distribution Under The Hood
UEMB270: Software Distribution Under The HoodIvanti
 
Oracle database performance tuning
Oracle database performance tuningOracle database performance tuning
Oracle database performance tuningAbishek V S
 
An Overview on Data Quality Issues at Data Staging ETL
An Overview on Data Quality Issues at Data Staging ETLAn Overview on Data Quality Issues at Data Staging ETL
An Overview on Data Quality Issues at Data Staging ETLidescitation
 
Oracle Database Performance Tuning Basics
Oracle Database Performance Tuning BasicsOracle Database Performance Tuning Basics
Oracle Database Performance Tuning Basicsnitin anjankar
 
Identification of Performance Problems without the Diagnostic Pack
Identification of Performance Problems without the Diagnostic PackIdentification of Performance Problems without the Diagnostic Pack
Identification of Performance Problems without the Diagnostic PackChristian Antognini
 
Process State vs. Object State: Modeling Best Practices for Simple Workflows ...
Process State vs. Object State: Modeling Best Practices for Simple Workflows ...Process State vs. Object State: Modeling Best Practices for Simple Workflows ...
Process State vs. Object State: Modeling Best Practices for Simple Workflows ...Thorsten Franz
 
Testing regression
Testing regressionTesting regression
Testing regressionRichie Lee
 
OER Unit 4 Virtual Private Database
OER Unit 4 Virtual Private DatabaseOER Unit 4 Virtual Private Database
OER Unit 4 Virtual Private DatabaseGirija Muscut
 
Crafted Design - LJC World Tour Mash Up 2014
Crafted Design - LJC World Tour Mash Up 2014Crafted Design - LJC World Tour Mash Up 2014
Crafted Design - LJC World Tour Mash Up 2014Sandro Mancuso
 

What's hot (19)

Soumya sree Sridharala
Soumya sree SridharalaSoumya sree Sridharala
Soumya sree Sridharala
 
Automated Testing with Databases
Automated Testing with DatabasesAutomated Testing with Databases
Automated Testing with Databases
 
Process management seminar
Process management seminarProcess management seminar
Process management seminar
 
A-Project Report- SSIS
A-Project Report- SSISA-Project Report- SSIS
A-Project Report- SSIS
 
Active database
Active databaseActive database
Active database
 
data stage-material
data stage-materialdata stage-material
data stage-material
 
Effective Test Driven Database Development
Effective Test Driven Database DevelopmentEffective Test Driven Database Development
Effective Test Driven Database Development
 
Cts informatica interview question answers
Cts informatica interview question answersCts informatica interview question answers
Cts informatica interview question answers
 
UEMB270: Software Distribution Under The Hood
UEMB270: Software Distribution Under The HoodUEMB270: Software Distribution Under The Hood
UEMB270: Software Distribution Under The Hood
 
Oracle database performance tuning
Oracle database performance tuningOracle database performance tuning
Oracle database performance tuning
 
An Overview on Data Quality Issues at Data Staging ETL
An Overview on Data Quality Issues at Data Staging ETLAn Overview on Data Quality Issues at Data Staging ETL
An Overview on Data Quality Issues at Data Staging ETL
 
Oracle Database Performance Tuning Basics
Oracle Database Performance Tuning BasicsOracle Database Performance Tuning Basics
Oracle Database Performance Tuning Basics
 
Identification of Performance Problems without the Diagnostic Pack
Identification of Performance Problems without the Diagnostic PackIdentification of Performance Problems without the Diagnostic Pack
Identification of Performance Problems without the Diagnostic Pack
 
Process State vs. Object State: Modeling Best Practices for Simple Workflows ...
Process State vs. Object State: Modeling Best Practices for Simple Workflows ...Process State vs. Object State: Modeling Best Practices for Simple Workflows ...
Process State vs. Object State: Modeling Best Practices for Simple Workflows ...
 
Batch Process Analytics
Batch Process Analytics Batch Process Analytics
Batch Process Analytics
 
Dbcc.doc
Dbcc.docDbcc.doc
Dbcc.doc
 
Testing regression
Testing regressionTesting regression
Testing regression
 
OER Unit 4 Virtual Private Database
OER Unit 4 Virtual Private DatabaseOER Unit 4 Virtual Private Database
OER Unit 4 Virtual Private Database
 
Crafted Design - LJC World Tour Mash Up 2014
Crafted Design - LJC World Tour Mash Up 2014Crafted Design - LJC World Tour Mash Up 2014
Crafted Design - LJC World Tour Mash Up 2014
 

Viewers also liked

Testing Database Changes
Testing Database ChangesTesting Database Changes
Testing Database ChangesSazed Monsur
 
Testing database content with DBUnit. My experience.
Testing database content with DBUnit. My experience.Testing database content with DBUnit. My experience.
Testing database content with DBUnit. My experience.Serhii Kartashov
 
xUnit Style Database Testing
xUnit Style Database TestingxUnit Style Database Testing
xUnit Style Database TestingChris Oldwood
 
Database testing in postgresql query
Database testing  in postgresql query Database testing  in postgresql query
Database testing in postgresql query mohammed najim
 
Basic Database Testing
Basic Database TestingBasic Database Testing
Basic Database TestingKumar S
 
Database Web Application Usability Testing
Database Web Application Usability TestingDatabase Web Application Usability Testing
Database Web Application Usability TestingTim Broadwater
 
01 software test engineering (manual testing)
01 software test engineering (manual testing)01 software test engineering (manual testing)
01 software test engineering (manual testing)Siddireddy Balu
 
Testing in Agile Projects
Testing in Agile ProjectsTesting in Agile Projects
Testing in Agile Projectssriks7
 
Agile QA presentation
Agile QA presentationAgile QA presentation
Agile QA presentationCarl Bruiners
 
Agile tour ncr test360_degree - agile testing on steroids
Agile tour ncr test360_degree - agile testing on steroidsAgile tour ncr test360_degree - agile testing on steroids
Agile tour ncr test360_degree - agile testing on steroidsVipul Gupta
 
Agile Testing: The Role Of The Agile Tester
Agile Testing: The Role Of The Agile TesterAgile Testing: The Role Of The Agile Tester
Agile Testing: The Role Of The Agile TesterDeclan Whelan
 
Agile Testing Process
Agile Testing ProcessAgile Testing Process
Agile Testing ProcessIntetics
 
Introduction to Agile software testing
Introduction to Agile software testingIntroduction to Agile software testing
Introduction to Agile software testingKMS Technology
 
WHITE BOX & BLACK BOX TESTING IN DATABASE
WHITE BOX & BLACK BOXTESTING IN DATABASEWHITE BOX & BLACK BOXTESTING IN DATABASE
WHITE BOX & BLACK BOX TESTING IN DATABASESalman Memon
 
Quality Assurance and Software Testing
Quality Assurance and Software TestingQuality Assurance and Software Testing
Quality Assurance and Software Testingpingkapil
 

Viewers also liked (19)

Testing Database Changes
Testing Database ChangesTesting Database Changes
Testing Database Changes
 
Testing database content with DBUnit. My experience.
Testing database content with DBUnit. My experience.Testing database content with DBUnit. My experience.
Testing database content with DBUnit. My experience.
 
xUnit Style Database Testing
xUnit Style Database TestingxUnit Style Database Testing
xUnit Style Database Testing
 
Database testing in postgresql query
Database testing  in postgresql query Database testing  in postgresql query
Database testing in postgresql query
 
Software Database and Testing
Software Database and TestingSoftware Database and Testing
Software Database and Testing
 
Database testing
Database testingDatabase testing
Database testing
 
Basic Database Testing
Basic Database TestingBasic Database Testing
Basic Database Testing
 
Database Web Application Usability Testing
Database Web Application Usability TestingDatabase Web Application Usability Testing
Database Web Application Usability Testing
 
01 software test engineering (manual testing)
01 software test engineering (manual testing)01 software test engineering (manual testing)
01 software test engineering (manual testing)
 
Testing in Agile Projects
Testing in Agile ProjectsTesting in Agile Projects
Testing in Agile Projects
 
Agile QA presentation
Agile QA presentationAgile QA presentation
Agile QA presentation
 
Agile tour ncr test360_degree - agile testing on steroids
Agile tour ncr test360_degree - agile testing on steroidsAgile tour ncr test360_degree - agile testing on steroids
Agile tour ncr test360_degree - agile testing on steroids
 
Agile Testing
Agile TestingAgile Testing
Agile Testing
 
Agile Testing: The Role Of The Agile Tester
Agile Testing: The Role Of The Agile TesterAgile Testing: The Role Of The Agile Tester
Agile Testing: The Role Of The Agile Tester
 
Agile Testing Process
Agile Testing ProcessAgile Testing Process
Agile Testing Process
 
Introduction to Agile software testing
Introduction to Agile software testingIntroduction to Agile software testing
Introduction to Agile software testing
 
Agile QA Process
Agile QA ProcessAgile QA Process
Agile QA Process
 
WHITE BOX & BLACK BOX TESTING IN DATABASE
WHITE BOX & BLACK BOXTESTING IN DATABASEWHITE BOX & BLACK BOXTESTING IN DATABASE
WHITE BOX & BLACK BOX TESTING IN DATABASE
 
Quality Assurance and Software Testing
Quality Assurance and Software TestingQuality Assurance and Software Testing
Quality Assurance and Software Testing
 

Similar to Database testing

Sql Interview Questions
Sql Interview QuestionsSql Interview Questions
Sql Interview Questionsarjundwh
 
153680 sqlinterview
153680  sqlinterview153680  sqlinterview
153680 sqlinterviewzdsgsgdf
 
Dbms important questions and answers
Dbms important questions and answersDbms important questions and answers
Dbms important questions and answersLakshmiSarvani6
 
Myth busters - performance tuning 102 2008
Myth busters - performance tuning 102 2008Myth busters - performance tuning 102 2008
Myth busters - performance tuning 102 2008paulguerin
 
Dbms interview questions
Dbms interview questionsDbms interview questions
Dbms interview questionsambika93
 
SQL dabatase interveiw pdf for interveiw preparation
SQL dabatase  interveiw pdf for interveiw preparationSQL dabatase  interveiw pdf for interveiw preparation
SQL dabatase interveiw pdf for interveiw preparationkumarvikesh2841998
 
Getting to know oracle database objects iot, mviews, clusters and more…
Getting to know oracle database objects iot, mviews, clusters and more…Getting to know oracle database objects iot, mviews, clusters and more…
Getting to know oracle database objects iot, mviews, clusters and more…Aaron Shilo
 
Sql interview question part 5
Sql interview question part 5Sql interview question part 5
Sql interview question part 5kaashiv1
 
Islamic University Previous Year Question Solution 2018 (ADBMS)
Islamic University Previous Year Question Solution 2018 (ADBMS)Islamic University Previous Year Question Solution 2018 (ADBMS)
Islamic University Previous Year Question Solution 2018 (ADBMS)Rakibul Hasan Pranto
 

Similar to Database testing (20)

Sql
SqlSql
Sql
 
Sql Interview Questions
Sql Interview QuestionsSql Interview Questions
Sql Interview Questions
 
Sql
SqlSql
Sql
 
Sql
SqlSql
Sql
 
153680 sqlinterview
153680  sqlinterview153680  sqlinterview
153680 sqlinterview
 
Dbms important questions and answers
Dbms important questions and answersDbms important questions and answers
Dbms important questions and answers
 
Myth busters - performance tuning 102 2008
Myth busters - performance tuning 102 2008Myth busters - performance tuning 102 2008
Myth busters - performance tuning 102 2008
 
Sq lite
Sq liteSq lite
Sq lite
 
Viva voce
Viva voceViva voce
Viva voce
 
Dbms interview questions
Dbms interview questionsDbms interview questions
Dbms interview questions
 
SQL dabatase interveiw pdf for interveiw preparation
SQL dabatase  interveiw pdf for interveiw preparationSQL dabatase  interveiw pdf for interveiw preparation
SQL dabatase interveiw pdf for interveiw preparation
 
Sql server
Sql serverSql server
Sql server
 
Database Basics
Database BasicsDatabase Basics
Database Basics
 
Getting to know oracle database objects iot, mviews, clusters and more…
Getting to know oracle database objects iot, mviews, clusters and more…Getting to know oracle database objects iot, mviews, clusters and more…
Getting to know oracle database objects iot, mviews, clusters and more…
 
MSSQL_Book.pdf
MSSQL_Book.pdfMSSQL_Book.pdf
MSSQL_Book.pdf
 
Ebook5
Ebook5Ebook5
Ebook5
 
Sql interview question part 5
Sql interview question part 5Sql interview question part 5
Sql interview question part 5
 
Data warehouse physical design
Data warehouse physical designData warehouse physical design
Data warehouse physical design
 
Islamic University Previous Year Question Solution 2018 (ADBMS)
Islamic University Previous Year Question Solution 2018 (ADBMS)Islamic University Previous Year Question Solution 2018 (ADBMS)
Islamic University Previous Year Question Solution 2018 (ADBMS)
 
T-SQL Overview
T-SQL OverviewT-SQL Overview
T-SQL Overview
 

More from Pesara Swamy

Swamy Pesara_5_yrs_exp
Swamy Pesara_5_yrs_expSwamy Pesara_5_yrs_exp
Swamy Pesara_5_yrs_expPesara Swamy
 
Performance testing tool
Performance testing toolPerformance testing tool
Performance testing toolPesara Swamy
 
Etl testing & basics of sql
Etl testing & basics of sqlEtl testing & basics of sql
Etl testing & basics of sqlPesara Swamy
 
Sdlc process document
Sdlc process documentSdlc process document
Sdlc process documentPesara Swamy
 

More from Pesara Swamy (7)

Swamy Pesara_5_yrs_exp
Swamy Pesara_5_yrs_expSwamy Pesara_5_yrs_exp
Swamy Pesara_5_yrs_exp
 
Performance testing tool
Performance testing toolPerformance testing tool
Performance testing tool
 
Component testing
Component testingComponent testing
Component testing
 
What is selenium
What is seleniumWhat is selenium
What is selenium
 
Etl testing
Etl testingEtl testing
Etl testing
 
Etl testing & basics of sql
Etl testing & basics of sqlEtl testing & basics of sql
Etl testing & basics of sql
 
Sdlc process document
Sdlc process documentSdlc process document
Sdlc process document
 

Recently uploaded

How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 

Recently uploaded (20)

How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 

Database testing

  • 1. Q.What is Database testing ? Testing the backend databases like comparing the actual results with expected results. Q. What we test in database testing Data bas testing basically include the following. 1)Data validity testing. 2)Data Integrity testing 3)Performance related to database. 4)Testing of Procedure, triggers and functions. For doing data validity testing you should be good in SQL queries For data integrity testing you should know about referential integrity and different constraint. For performance related things you should have idea about the table structure and design. For testing Procedure triggers and functions you should be able to understand the same. Q.What are the different stages involved in Database Testing? In DB testing we need to check for, 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.What SQL statements have you used in Database Testing? DDL DDL is Data Definition Language statements. Some examples: • CREATE • ALTER - • DROP -• TRUNCATE -• COMMENT - • RENAME – DML DML is Data Manipulation Language statements. Some examples: • SELECT - • INSERT - • UPDATE - • DELETE - • MERGE - UPSERT -• CALL - • EXPLAIN PLAN - • LOCK TABLE – DCL DCL is Data Control Language statements. Some examples: • GRANT - • REVOKE - • COMMIT - • SAVEPOINT - • ROLLBACK - COMMIT -• SET TRANSACTION - This are the Database testing commands. Q.What is a Primary Key? A primary key is a single column or multiple columns defined to have unique values that can be used as row identifications Q.What is a Foreign Key? A foreign key is a single column or a multiple columns defined to have values that can be mapped to a primary key in another table. Q.What we normally check for in the Database Testing? Database testing involves some in-depth knowledge of the given application and requires more defined plan of approach to test the data. Key issues include: 1)data Integrity 2)data validity 3)data manipulation and updates. Tester must be aware of the database design concepts and implementation rules Q.How to Test database in Manually? Explain with an example Observing that operations, which are operated on front-end is effected on back-end or not. The approach is as follows: While adding a record thru' front-end check back-end that addition of record is effected or not. So same for delete, update... Ex: Enter employee record in database thru' front-end and check if the record is added or not to the back-end (manually). Q.What is an Index? An index is a single column or multiple columns defined to have values pre-sorted to speed up data retrieval speed.
  • 2. Q.What are NULL values? NULL represents no value NULL is not the same as an empty string ‘’ NULL is not same as zero value (0) NULL can be used as any data type NULL should not be used in any comparison operators NULL has its own equality operator IS and not-equality operator IS NOT Q.What is the difference between oracle, sql and sql server ? •Oracle is based on RDBMS. •SQL is Structured Query Language. •SQL Server is another tool for RDBMS provided by MicroSoft. Q.Why you need indexing? where that is Stored and what you mean by schema object? For what purpose we are using view? We can't create an Index on Index.. Index is stoed in user_index table. Every object that has been created on Schema is Schema Object like Table, View etc. If we want to share the particular data to various users we have to use the virtual table for the Base table. So that is a view. Indexing is used for faster search or to retrieve data faster from various table. Schema containing set of tables, basically schema means logical separation of the database. View is crated for faster retrieval of data. It's customized virtual table. we can create a single view of multiple tables. Only the drawback is..view needs to be get refreshed for retrieving updated data. Q.What is the difference between TRUNCATE and DELETE commands? •Both will result in deleting all the rows in the table .TRUNCATE call cannot be rolled back as it is a DDL command and all memory space for that table is released back to the server. TRUNCATE is much faster.Whereas DELETE call is an DML command and can be rolled back. Q.Which system table contains information on constraints on all the tables created ? USER_CONSTRAINTS, system table contains information on constraints on all the tables created Q.what operator performs pattern matching? Pattern matching operator is LIKE and it has to used with two attributes 1.% means matches zero or more characters and 2._( underscore ) means matching exactly one character Q.What is cluster.cluster index and non cluster index ? Clustered Index:- A Clustered index is a special type of index that reorders the way records in the table are physically stored. Therefore table may have only one clustered index.Non-Clustered Index:- A Non-Clustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows in the disk. The leaf nodes of a non-clustered index does not consists of the data pages. instead the leaf node contains index rows. Q.What is GROUP BY? The GROUP BY keywords has 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. Q.What are defaults? Is there a column to which a default can't be bound? A default is a value that will be used by a column, if no value is supplied to that column while inserting data. IDENTITY columns and timestamp columns can't have defaults bound to them. Q.What is an extended stored procedure? Can you instantiate a COM object by using T-SQL? An extended stored procedure is a function within a DLL (written in a programming language like C, C++ using Open Data Services (ODS) API) that can be called from T-SQL, just the way we call normal stored procedures using the EXEC statement. See books online to learn how to create extended stored procedures and how to add them to SQL Server. You can instantiate a COM (written in languages like VB, VC++) object from T-SQL by using sp_OACreate stored procedure.
  • 3. Q.What is Trigger? A trigger is a SQL procedure that initiates an action when an event (INSERT, DELETE or UPDATE) occurs. Triggers are stored in and managed by the DBMS. Triggers are used to maintain the referential integrity of data by changing the data in a systematic fashion. A trigger cannot be called or executed; DBMS automatically fires the trigger as a result of a data modification to the associated table. Triggers can be viewed as similar to stored procedures in that both consist of procedural logic that is stored at the database level. Stored procedures, however, are not event-drive and are not attached to a specific table as triggers are. Stored procedures are explicitly executed by invoking a CALL to the procedure while triggers are implicitly executed. In addition, triggers can also execute stored procedures. Q.What is User Defined Functions? What kind of User-Defined Functions can be created? User-Defined Functions allow defining its own T-SQL functions that can accept 0 or more parameters and return a single scalar data value or a table data type. Different Kinds of User-Defined Functions created are: 1.Scalar User-Defined Function A Scalar user-defined function returns one of the scalar data types. Text, ntext, image and timestamp data types are not supported. These are the type of user-defined functions that most developers are used to in other programming languages. You pass in 0 to many parameters and you get a return value. 2.Inline Table-Value User-Defined Function An Inline Table-Value user-defined function returns a table data type and is an exceptional alternative to a view as the user-defined function can pass parameters into a T-SQL select command and in essence provide us with a parameterized, non-updateable view of the underlying tables. 3.Multi-statement Table-Value User-Defined Function A Multi-Statement Table-Value user-defined function returns a table and is also an exceptional alternative to a view as the function can support multiple T-SQL statements to build the final result where the view is limited to a single SELECT statement. Also, the ability to pass parameters into a TSQL select command or a group of them gives us the capability to in essence create a parameterized, non-updateable view of the data in the underlying tables. Within the create function command you must define the table structure that is being returned. After creating this type of user-defined function, It can be used in the FROM clause of a T-SQL command unlike the behavior found when using a stored procedure which can also return record sets Q.What is Identity? Identity (or AutoNumber) is a column that automatically generates numeric values. A start and increment value can be set, but most DBA leave these at 1. A GUID column also generates numbers; the value of this cannot be controlled. Identity/GUID columns do not need to be indexed. Q.What is blocking and how would you troubleshoot it? Blocking happens when one connection from an application holds a lock and a second connection requires a conflicting lock type. This forces the second connection to wait, blocked on the first. Q.Determine the name sex and age of the oldest student. SELECT Name, Gender, (CURRENT_DATE-Dtnaiss)/365 AS Age FROM Student WHERE (CURRENT_DATE-Dtnaiss) /365 = ( SELECT MAX(( CURRENT_DATE-Dtnaiss) /365) FROM Student); Q.Common SQL Syntax used in database interaction a.Select Statement SELECT "column_name" FROM "table_name" b.Distinct SELECT DISTINCT "column_name" FROM "table_name" c.Where SELECT "column_name" FROM "table_name" WHERE "condition" d.And/Or SELECT "column_name" FROM "table_name" WHERE "simple condition" {[AND|OR] "simple condition"}+ e.In SELECT "column_name" FROM "table_name" WHERE "column_name" IN ('value1', 'value2', ...) f.Between SELECT "column_name" FROM "table_name" WHERE "column_name" BETWEEN 'value1' AND 'value2'
  • 4. g.Like SELECT "column_name" FROM "table_name" WHERE "column_name" LIKE {PATTERN} h.Order By SELECT "column_name" FROM "table_name" [WHERE "condition"] ORDER BY "column_name" [ASC, DESC] i.Count SELECT COUNT("column_name") FROM "table_name" j.Group By SELECT "column_name1", SUM("column_name2") FROM "table_name" GROUP BY "column_name1" k.Having SELECT "column_name1", SUM("column_name2") FROM "table_name" GROUP BY "column_name1" HAVING (arithematic function condition) l.Create Table Statement CREATE TABLE "table_name" ("column 1" "data_type_for_column_1","column 2" "data_type_for_column_2",…) m.Drop Table Statement DROP TABLE "table_name" n.Truncate Table Statement TRUNCATE TABLE "table_name" m.Insert Into Statement INSERT INTO "table_name" ("column1", "column2", ...) VALUES ("value1", "value2", ...) o.Update Statement UPDATE "table_name" SET "column_1" = [new value] WHERE {condition} p.Delete From Statement DELETE FROM "table_name" WHERE {condition} Q.SQL CREATE VIEW Syntax CREATE VIEW view_name AS SELECT column_name(s) FROM table_name WHERE condition Q.How to find out the 10th highest salary in SQL query? Table - Tbl_Test_Salary Column - int_salary select max(int_salary) from Tbl_Test_Salary where int_salary in(select top 10 int_Salary from Tbl_Test_Salary order by int_salary) Q.How to test a SQL Query in WinRunner? With out using Database Checkpoints? By writing scripting procedure in the TCL we can connect to the database and we can test database and queries. Q.How does you test whether a database in updated when information is entered in the front end? With database check point only in WinRunner, but in manual we will go to front end using some information. Will get some session names using that session names we search in backend. If that information is correct then we will see query results. Q.Write a query to find the 5th details from a table SELECT column_name FROM table_name WHERE auto_incremented_id= (SELECT TOP 1 auto_incremented_id FROM (SELECT TOP 3 auto_incremented_id FROM employee ORDER BY auto_incremented_id ASC) table_name ORDER BY auto_incremented_id DESC); Q.Write a Query to display the Top N rows ? MySQL SELECT column_name FROM table_name LIMIT number
  • 5. SQL Server SELECT TOP number/percent column_name FROM table_name Oracle SELECT column_name FROM table_name WHERE ROWNUM<= number Q.Difference between Stored Procedure and Trigger? •we can call stored procedure explicitly. •but trigger is automatically invoked when the action defined in trigger is done. ex: create trigger after Insert on •this trigger invoked after we insert something on that table. •Stored procedure can't be inactive but trigger can be Inactive. •Triggers are used to initiate a particular activity after fulfilling certain condition.It need to define and can be enable and disable according to need. Q.What is the advantage to use trigger in your PL? A trigger is a database object directly associated with a particular table. It fires whenever a specific statement/type of statement is issued against that table. The types of statements are insert,update,delete and query statements. Basically, trigger is a set of SQL statements A trigger is a solution to the restrictions of a constraint. For instance: 1.A database column cannot carry PSEUDO columns as criteria where a trigger can. 2. A database constraint cannot refer old and new values for a row where a trigger can. Triggers are fired implicitly on the tables/views on which they are created. There are various advantages of using a trigger. Some of them are: •Suppose we need to validate a DML statement(insert/Update/Delete) that modifies a table then we can write a trigger on the table that gets fired implicitly whenever DML statement is executed on that table. •Another reason of using triggers can be for automatic updation of one or more tables whenever a DML/DDL statement is executed for the table on which the trigger is created. •Triggers can be used to enforce constraints. For eg : Any insert/update/ Delete statements should not be allowed on a particular table after office hours. For enforcing this constraint Triggers should be used. •Triggers can be used to publish information about database events to subscribers. Database event can be a system event like Database startup or shutdown or it can be a user even like User loggin in or user logoff. Q.What are the tradeoffs with having indexes? 1.Faster selects, slower updates. 2.Extra storage space to store indexes. Updates are slower because in addition to updating the table you have to update the index. Q.What is "normalization"? "Denormalization"? Why do you sometimes want to denormalize? Normalizing data means eliminating redundant information from a table and organizing the data so that future changes to the table are easier. Denormalization means allowing redundancy in a table. The main benefit of denormalization is improved performance with simplified data retrieval and manipulation. This is done by reduction in the number of joins needed for data processing. Q.What is a "constraint"? A constraint allows you to apply simple referential integrity checks to a table. There are four primary types of constraints PRIMARY/UNIQUE - enforces uniqueness of a particular table column. But by default primary key creates a clustered index on the column, where are unique creates a non-clustered index by default. Another major difference is that, primary key doesn't allow NULLs, but unique key allows one NULL only DEFAULT - specifies a default value for a column in case an insert operation does not provide one. FOREIGN KEY - validates that every value in a column exists in a column of another table. CHECK - checks that every value stored in a column is in some specified list. Each type of constraint performs a specific type of action. Default is not a constraint. NOT NULL is one more constraint which does not allow values in the specific column to be null. And also it the only constraint which is not a table level constraint. Q.What is the system function to get the current user's details such as userid etc. ? USER USER_ID USER_NAME CURRENT_USER
  • 6. SUSER_SID HOST_NAME SYSTEM_USER SESSION_USER Q.What is Stored Procedure? A stored procedure is a named group of SQL statements that have been previously created and stored in the server database. Stored procedures accept input parameters so that a single procedure can be used over the network by several clients using different input data. And when the procedure is modified, all clients automatically get the new version. Stored procedures reduce network traffic and improve performance. Stored procedures can be used to help ensure the integrity of the database. Q.What are the different isolation levels ? An isolation level determines the degree of isolation of data between concurrent transactions. The default SQL Server isolation level is Read Committed. Here are the other isolation levels (in the ascending order of isolation): Read Uncommitted, Read Committed, Repeatable Read, Serializable. Q.What would happen if you create an index on each column of a table ? If you create an index on each column of a table, it improves the query performance, as the query optimizer tool of the Database engine can choose from all the existing indexes to come up with an efficient execution plan. At the same time, data modification operations (such as INSERT, UPDATE, DELETE) will become slow, as every time data changes in the table, all the indexes need to be updated. Another disadvantage is that, indexes need disk space, the more indexes you have, more disk space is used. Q.The SQL statement to find the departments that have employees with a salary higher than the average employee salary SELECT name FROM dept WHERE id IN ( SELECT dept_id FROM emp WHERE sal> (SELECT avg(sal)FROM emp) ) Q.Write the SQL to use a sub query which will not return any rows - when just the table structure is required and not any of the data. CREATE TABLE new_table AS SELECT * from table_orig WHERE 1=0; The sub query returns no data but does return the column names and data types to the 'create table' statement.