0% found this document useful (0 votes)
2 views1 page

Data Validating in ETL

The document provides SQL queries for testing data accuracy, completeness, and consistency. It includes examples for checking duplicates, null values, and data types. Each query is explained with its purpose and expected output.

Uploaded by

maheshtester9595
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Data Validating in ETL

The document provides SQL queries for testing data accuracy, completeness, and consistency. It includes examples for checking duplicates, null values, and data types. Each query is explained with its purpose and expected output.

Uploaded by

maheshtester9595
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

3/13/23, 11:23 AM New chat

New chat

SQL query to test data in SQL

To test data in SQL, you can write queries that validate the accuracy, completeness, and
consistency of the data. Here are some examples of SQL queries that you can use for
testing:

1. Check for duplicates:


SELECT column1, column2, COUNT()
FROM table_name
GROUP BY column1, column2
HAVING COUNT() > 1;

This query checks for duplicates in the specified columns of a table. If there are duplicates,
the query will return the values of the columns and the count of duplicates.

2. Check for null values:


SELECT COUNT(*)
FROM table_name
WHERE column_name IS NULL;

This query checks for null values in the specified column of a table. If there are null values,
the query will return the count of null values.

3. Check for data type:


SELECT *
FROM table_name
WHERE ISNUMERIC(column_name) = 0;

This query checks if the data in the specified column is numeric. If the data is not numeric,
the query will return the rows with non-numeric values.
ChatGPT Feb 13 Version. Free Research Preview. Our goal is to make AI systems more natural and safe to interact with. Your feedback
4. Check for missing data: will help us improve.

https://chat.openai.com/chat 1/1

You might also like