Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tpeterw/mysql-query-builder
MySQL query statement builder with natural semantics
https://github.com/tpeterw/mysql-query-builder
java mysql mysql-query-builder natural-semantics
Last synced: 18 days ago
JSON representation
MySQL query statement builder with natural semantics
- Host: GitHub
- URL: https://github.com/tpeterw/mysql-query-builder
- Owner: TPeterW
- License: mit
- Created: 2017-05-06T08:36:25.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-05-12T07:20:55.000Z (over 7 years ago)
- Last Synced: 2024-11-10T21:30:36.716Z (3 months ago)
- Topics: java, mysql, mysql-query-builder, natural-semantics
- Language: Java
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SQL-Query-Builder
SQL query statement builder with natural semanticsUsage
----
### *Just chain everything together* ---- ChemistryString query1 = new SQLQuery()
.select('*')
.from("manuscript")
.where(new SQLCondition()
.whereAttribute("status")
.equalsTo("under review")
.andAttribute("manuscript_id")
.inSubquery(new SQLSubquery()
.select("manuscript_id")
.from("feedback")))
.create();
String query2 = new SQLQuery()
.select("manuscript_id")
.fromSubquery(new SQLSubquery()
.whereTable(new SQLSubquery()
.select("manuscript.manuscript_id", "author_id")
.from("manuscript")
.joinsTable("feedback")
.as('T'))
.joinsTable("issue")
.onAttribute("issue", "period_number"))
.groupBy("author_id")
.orderBy("pub_year", true)
.create();String query3 = new SQLQuery()
.select('*')
.from("manuscript")
.groupBy("author_id")
.orderBy("author_id", false)
.orderBy("status", true)
.create();
String insert1 = new SQLInsertion()
.intoTable("rihelper")
.intoColumns("reviewer_id", "ricode_id")
.withValues("123456", "111111")
.withValues("234567", "222222")
.create();String update1 = new SQLUpdate()
.updateTable("author")
.setAttributeTo("email", "[email protected]")
.setAttributeTo("affiliation", 1)
.where(new SQLCondition()
.whereAttribute("author_id")
.equalsTo(123456))
.create();String delete1 = new SQLDelete()
.fromTable("manuscript")
.where(new SQLCondition()
.whereAttribute("author_id")
.equalsTo("123456"))
.create();stmt.executeQuery(new SQLQuery()
.select('*')
.from("manuscript")
.create());