Class TestGroupByHaving
- java.lang.Object
-
- junit.framework.Assert
-
- junit.framework.TestCase
-
- org.hsqldb.test.TestGroupByHaving
-
- All Implemented Interfaces:
- junit.framework.Test
public class TestGroupByHaving extends junit.framework.TestCaseTest cases for HSQL aggregates and HAVING clause.
-
-
Constructor Summary
Constructors Constructor and Description TestGroupByHaving(java.lang.String s)Constructs a new SubselectTest.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidtestAggregatedGroupBy()Tests aggregated selection with a GROUP_BY clause.voidtestAggregatedGroupByHaving1()Tests aggregated selection with a GROUP_BY clause and a HAVING clause.voidtestAggregatedGroupByHaving2()Tests aggregated selection with a GROUP_BY clause and a HAVING clause.voidtestHavingWithoutGroupBy1()Tests an unusual usage of the HAVING clause, without a GROUP BY clause.voidtestHavingWithoutGroupBy2()Tests an unusual usage of the HAVING clause, without a GROUP BY clause.voidtestInvalidHaving()Tests an invalid HAVING clause that contains columns not in the GROUP BY clause.-
Methods inherited from class junit.framework.TestCase
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, setName, toString
-
-
-
-
Constructor Detail
-
TestGroupByHaving
public TestGroupByHaving(java.lang.String s)
Constructs a new SubselectTest.
-
-
Method Detail
-
testAggregatedGroupBy
public void testAggregatedGroupBy() throws java.sql.SQLExceptionTests aggregated selection with a GROUP_BY clause. This is a normal use of the GROUP_BY clause. The first two employees do not have a superior, and must be grouped within the same group, according to GROUP_BY standard.- Throws:
java.sql.SQLException
-
testAggregatedGroupByHaving1
public void testAggregatedGroupByHaving1() throws java.sql.SQLExceptionTests aggregated selection with a GROUP_BY clause and a HAVING clause.This is a typical use of the GROUP_BY + HAVING clause. The first two employees are eliminated due to the HAVING condition.
This test uses aggregated function to eliminate first group.
- Throws:
java.sql.SQLException
-
testAggregatedGroupByHaving2
public void testAggregatedGroupByHaving2() throws java.sql.SQLExceptionTests aggregated selection with a GROUP_BY clause and a HAVING clause.This is a typical use of the GROUP_BY + HAVING clause. The first two employees are eliminated due to the HAVING condition.
This test uses GROUP_BY column to eliminate first group.
- Throws:
java.sql.SQLException
-
testHavingWithoutGroupBy1
public void testHavingWithoutGroupBy1() throws java.sql.SQLExceptionTests an unusual usage of the HAVING clause, without a GROUP BY clause.Only one row is returned by the aggregate selection without a GROUP BY clause. The HAVING clause is applied to the only returned row. In this case, the HAVING condition is satisfied.
- Throws:
java.sql.SQLException
-
testHavingWithoutGroupBy2
public void testHavingWithoutGroupBy2() throws java.sql.SQLExceptionTests an unusual usage of the HAVING clause, without a GROUP BY clause.Only one row is returned by the aggregate selection without a GROUP BY clause. The HAVING clause is applied to the only returned row. In this case, the HAVING condition is NOT satisfied.
- Throws:
java.sql.SQLException
-
testInvalidHaving
public void testInvalidHaving() throws java.sql.SQLExceptionTests an invalid HAVING clause that contains columns not in the GROUP BY clause. A SQLException should be thrown.- Throws:
java.sql.SQLException
-
-
DataMelt 3.0 © DataMelt by jWork.ORG