diff --git a/dbtng_example/dbtng_example.module b/dbtng_example/dbtng_example.module
index f468dc4..c511b3a 100644
--- a/dbtng_example/dbtng_example.module
+++ b/dbtng_example/dbtng_example.module
@@ -344,6 +344,9 @@ function dbtng_example_help($path) {
     case 'examples/dbtng/add':
       $output = t('Add an entry to the dbtng_example table.');
       break;
+
+    case 'examples/dbtng/ordered_list':
+      $output = t('Generate a list of database records in ordering format. The records will be displayed in ascending order for column "Name".');
   }
   return $output;
 }
@@ -388,6 +391,12 @@ function dbtng_example_menu() {
     'access callback' => TRUE,
     'type' => MENU_LOCAL_TASK,
   );
+  $items['examples/dbtng/ordered_list'] = array(
+    'title' => 'Ordered list',
+    'page callback' => 'dbtng_example_ordered_list',
+    'access arguments' => array('access administration pages'),
+    'type' => MENU_LOCAL_TASK,
+  );
 
   return $items;
 }
@@ -574,6 +583,62 @@ function dbtng_example_form_update_submit($form, &$form_state) {
   drupal_set_message(t("Updated entry @entry (@count row updated)",
     array('@count' => $count, '@entry' => print_r($entry, TRUE))));
 }
+
+/**
+ * Render an ordered list of entries in the database.
+ */
+function dbtng_example_ordered_list() {
+  $result = dbtng_example_execute_ordered_select_query();
+  return dbtng_example_render_resultset_as_table($result);
+}
+
+/**
+ * This function queries the database and retrieves all the records in
+ * ascending order.
+ *
+ * The code below will result in the following query
+ * SELECT ex.pid AS pid, ex.uid AS uid, ex.name AS name, ex.surname AS surname,
+ * ex.age AS age
+ * FROM {dbtng_example} ex
+ * ORDER BY ex.name ASC
+ */
+function dbtng_example_execute_ordered_select_query() {
+  $dbtng_example_execute_ordered_select_query = db_select('dbtng_example', 'ex')->fields('ex');
+  // 'ex.name' is the field on which to order.
+  // Legal values for sorting are "ASC" and "DESC". Any other value will be
+  // converted to "ASC".
+  $dbtng_example_execute_ordered_select_query->orderBy('ex.name', 'ASC');
+  // generate the result in object format.
+  $dbtng_example_result = $dbtng_example_execute_ordered_select_query->execute()->fetchAll();
+  return $dbtng_example_result;
+}
+
+/**
+ * This function renders a resultset as table
+ */
+function dbtng_example_render_resultset_as_table($result) {
+  $rows = array();
+  if($result) {
+    foreach ($result as $row) {
+      // Sanitize the data before handing it off to the theme layer.
+      $rows[] = array_map('check_plain', (array) $row);
+    }
+  }
+  return dbtng_example_convert_resultset_to_table_render_array($rows);
+}
+
+/**
+ * This function renders array for table 'dbtng_example'
+ */
+function dbtng_example_convert_resultset_to_table_render_array($rows = array()) {
+  $header = array(t('Id'), t('uid'), t('Name'), t('Surname'), t('Age'));
+  return [
+    '#theme' => 'table',
+    '#header' => $header,
+    '#rows' => $rows,
+    '#empty' => t('No records found'),
+  ];
+}
 /**
  * @} End of "defgroup dbtng_example".
  */
