Skip to content

About

A Utility to generate Select Query

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

21 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SelectQueryBuilder

Codacy Badge Quality Gate Status Coverage

Examples

Some usage examples:

Example 1:

List<String> names = Arrays.asList("Larry", "Curly", "Moe");
SelectBuilder selectBuilder = new SelectBuilder()
                                    .column("*")
                                    .from("Emp")
                                    .where(Predicates.in("name", names));

The output is:

SELECT * FROM Emp WHERE name in (?, ?, ?)

Example 2:

SelectBuilder sb = new SelectBuilder("suppliers");
Predicate condition1 = Predicates.and(Predicates.eq("state", "California"),
                                      Predicates.neq("supplier_id", 900));
Predicate condition2 = Predicates.eq("supplier_id", 100);
sb.where(condition1).orWhere(condition2);

The output is:

SELECT * FROM suppliers WHERE (state = ? AND supplier_id <> ?) OR supplier_id = ?

Example 3:

SelectBuilder sb = new SelectBuilder().column("Customers.CustomerName", "Orders.OrderID")
                .from("Customers").fullOuterJoin("Orders ON Customers.CustomerID=Orders.CustomerID");

The output is:

SELECT Customers.CustomerName, Orders.OrderID FROM Customers FULL OUTER JOIN Orders ON Customers.CustomerID=Orders.CustomerID

About

A Utility to generate Select Query

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages