Results 1 to 2 of 2

Thread: Using SQL to query any Store

  1. #1
    Sencha User
    Join Date
    Oct 2012
    Dallas, TX
    Vote Rating

    Default Using SQL to query any Store

    To whomever likes SQL:

    Using the SequelSphereDB engine, I was able to create an '' Class that allows you to execute SQL against any data Store(s) managed by Here is some sample usage code:

    var store = Ext.create('', {
        storeId: "EmplDeptQuery",
        sql: "SELECT empl_id,, age, as dept_name " +
             "  FROM empl e " +
             "  JOIN dept d " +
             "    ON e.dept_id = d.dept_id " +
             " WHERE age > 20"
    In the above example, 'Empl' is an, and 'Dept' is an

    When SQL is executed, it all occurs in the browser, using the SequelSphereDB engine to parse and execute the SQL.

    The Code for can be found here:

    And an example app showing integration with a Grid and Chart along with more sample code can be found here:

    As one last example, consider this: let's get the departments whose managers are younger than the average age of the employees in the department.

    var store = Ext.create('', {
        storeId: "EmplDeptQuery",
        sql: "SELECT, count(*) as nbr_empls, avg(e.age) as age " +
             "     , as mgr_name, m.age as mgr_age " +
             "  FROM dept d " +
             "  JOIN empl e ON e.dept_id = d.dept_id " +
             "  JOIN empl m ON m.empl_id = d.mgr_id " +
             " GROUP BY,, m.age " +
             "HAVING m.age <= avg(e.age) " +
             " ORDER BY avg(e.age) - m.age desc"
    All feedback is welcome. Please let me know if there are other ways you think SQL could be incorporated with ExtJS.


    - John Fowler
    SequelSphere: An HTML5 / JavaScript Relational Database

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Gainesville, FL
    Vote Rating


    Nice contribution!
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts