Using the Select Statement to Test data

Questions by Srikanth B

Showing Answers 1 - 0 of 0 Answers

ashishks

  • Aug 28th, 2009
 

1. Select * from <Table Name>  ---> It will select all rows from the table.

2. Select <Column Name1>, <Column Name2 from <Table Name> ---> It will select all rows of column1 and column2.

3. Select <Column Name1>, <Column Name2> from <Table Name> where <Column Name>="Value"  ---> It will select data which mathes with given value.

4. Select <Column Name1>, <Column Name2> from <Table Name> where <Column Name> IN ("value1", "value2", "value3")

5. Select <Column Name> from <Table Name> where <column Name1>="value1" AND <Column Name2>="value2"

SELECT column_names FROM table_name
SELECT DISTINCT column_name FROM table_name
SELECT column_name FROM table_name WHERE condition
SELECT column_name FROM table_name WHERE condition1 AND condition2
SELECT column_name FROM table_name WHERE condition1 OR condition2
SELECT column_name FROM table_name WHERE column_name IN (value1, value2, ...)
SELECT column_name FROM table_name WHERE column_name BETWEEN value1 AND value2
SELECT column_name FROM table_name WHERE column_name LIKE pattern
SELECT column_name FROM table_name WHERE condition ORDER BY column_name [ASC, DESC]
SELECT AVG column_name FROM table_name
SELECT COUNT column_name FROM table_name
SELECT MAX column_name FROM table_name
SELECT MIN column_name FROM table_name
SELECT SUM column_name FROM table_name
SELECT column_name1 SUM column_name2 FROM table_name GROUP BY column_name1
SELECT column_name1 SUM column_name2 FROM table_name GROUP BY column_name1 HAVING arithmetic function condition
SELECT table_alias.column_name1 column_alias FROM table_name table_alias
SELECT table_alias.column_name1 AS column_alias FROM table_name AS table_alias

SELECT column_names FROM table_name1 JOIN table_name2 ON table_name1.join1 = table_name2.join2 WHERE condition
SELECT column_names FROM table_name1 INNER JOIN table_name2 ON table_name1.join1 = table_name2.join2 WHERE conditionSELECT column_names FROM table_name1 OUTER JOIN table_name2 ON table_name1.join1 = table_name2.join2 WHERE condition

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions