# Import database file .sql

**URL:** <https://community.thunkable.com/t/import-database-file-sql/37157>\
**Category:** Questions about Thunkable X\
**Created:** [July 23, 2018, 9:35am UTC](https://community.thunkable.com/t/import-database-file-sql/37157 "2018-07-23T09:35:10Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Milan\_Ghevariya](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/milan_ghevariya/32/23690_2.png) [@Milan\_Ghevariya](https://community.thunkable.com/u/Milan_Ghevariya)\
**Post date:** [July 23, 2018, 9:35am UTC](https://community.thunkable.com/t/import-database-file-sql/37157/1 "2018-07-23T09:35:10Z")

</div>

Hello friends ,

i have a .sql file of database, but i want to use in offline app, so how to i use this file in offline app.

please help me friends .

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [July 23, 2018, 9:38am UTC](https://community.thunkable.com/t/import-database-file-sql/37157/2 "2018-07-23T09:38:28Z")

</div>

Hello, export your file to a text block in CSV or JSON format.

---

<div class="post-metadata">

**Author:** ![Milan\_Ghevariya](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/milan_ghevariya/32/23690_2.png) [@Milan\_Ghevariya](https://community.thunkable.com/u/Milan_Ghevariya)\
**Post date:** [July 23, 2018, 9:39am UTC](https://community.thunkable.com/t/import-database-file-sql/37157/3 "2018-07-23T09:39:03Z")

</div>

but i have a .sql file

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [July 23, 2018, 9:42am UTC](https://community.thunkable.com/t/import-database-file-sql/37157/4 "2018-07-23T09:42:18Z")

</div>

You can convert it to the desired format.

[http://www.convertcsv.com/sql-to-csv.htm](http://www.convertcsv.com/sql-to-csv.htm)

If you do not want to convert it, then an algorithm is created for parsing data from this format with help of loop, text and list blocks.

---

<div class="post-metadata">

**Author:** ![Milan\_Ghevariya](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/milan_ghevariya/32/23690_2.png) [@Milan\_Ghevariya](https://community.thunkable.com/u/Milan_Ghevariya)\
**Post date:** [July 23, 2018, 9:44am UTC](https://community.thunkable.com/t/import-database-file-sql/37157/5 "2018-07-23T09:44:11Z")

</div>

after convert sql to csv then how to i import in app ??

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [July 23, 2018, 9:45am UTC](https://community.thunkable.com/t/import-database-file-sql/37157/6 "2018-07-23T09:45:27Z")

</div>

Copy the result data into a text block.

---

<div class="post-metadata">

**Author:** ![Milan\_Ghevariya](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/milan_ghevariya/32/23690_2.png) [@Milan\_Ghevariya](https://community.thunkable.com/u/Milan_Ghevariya)\
**Post date:** [July 23, 2018, 9:47am UTC](https://community.thunkable.com/t/import-database-file-sql/37157/7 "2018-07-23T09:47:03Z")

</div>

if i would like to import sql file then which extension i need to import ??

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [July 23, 2018, 9:47am UTC](https://community.thunkable.com/t/import-database-file-sql/37157/8 "2018-07-23T09:47:53Z")

</div>

Thunkable X does not have the ability to work with extensions

---

<div class="post-metadata">

**Author:** ![Milan\_Ghevariya](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/milan_ghevariya/32/23690_2.png) [@Milan\_Ghevariya](https://community.thunkable.com/u/Milan_Ghevariya)\
**Post date:** [July 23, 2018, 10:03am UTC](https://community.thunkable.com/t/import-database-file-sql/37157/9 "2018-07-23T10:03:58Z")

</div>

but thunkable classic is sported

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [July 23, 2018, 10:05am UTC](https://community.thunkable.com/t/import-database-file-sql/37157/10 "2018-07-23T10:05:10Z")

</div>

Thunkable Classic and Thunkable X are different development tools that have different functionality.

---

<div class="post-metadata">

**Author:** ![Milan\_Ghevariya](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/milan_ghevariya/32/23690_2.png) [@Milan\_Ghevariya](https://community.thunkable.com/u/Milan_Ghevariya)\
**Post date:** [July 23, 2018, 10:17am UTC](https://community.thunkable.com/t/import-database-file-sql/37157/11 "2018-07-23T10:17:27Z")

</div>

i have a sqliteAddons extension but in this i not to show import block, so have you any idea how to i import file of sql

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [July 23, 2018, 10:24am UTC](https://community.thunkable.com/t/import-database-file-sql/37157/12 "2018-07-23T10:24:12Z")

</div>

Do you mean by a .sql file a file with such data?

```
/**
 * Continents 
 */
SET FOREIGN_KEY_CHECKS=0;
 
-- ----------------------------
-- Table structure for `continents`
-- ----------------------------
DROP TABLE IF EXISTS `continents`;
CREATE TABLE `continents` (
  `code` char(2) NOT NULL COMMENT 'Continent code',
  `name` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;
 
-- ----------------------------
-- Records of continents
-- ----------------------------
INSERT INTO `continents` VALUES ('AF', 'Africa');
INSERT INTO `continents` VALUES ('AN', 'Antarctica');
INSERT INTO `continents` VALUES ('AS', 'Asia');
INSERT INTO `continents` VALUES ('EU', 'Europe');
INSERT INTO `continents` VALUES ('NA', 'North America');
INSERT INTO `continents` VALUES ('OC', 'Oceania');
INSERT INTO `continents` VALUES ('SA', 'South America');
INSERT INTO `continents` VALUES ('??', NULL);
```

---

<div class="post-metadata">

**Author:** ![Milan\_Ghevariya](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/milan_ghevariya/32/23690_2.png) [@Milan\_Ghevariya](https://community.thunkable.com/u/Milan_Ghevariya)\
**Post date:** [July 23, 2018, 10:27am UTC](https://community.thunkable.com/t/import-database-file-sql/37157/13 "2018-07-23T10:27:23Z")

</div>

yes, i have 600 record in table.

This data i want to show in my app, like

whene screen initialize then diaplay first record, when user click on next button then display second record, when user click on previous then display previous record as well as …

So how to do i ??

please help me

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [July 23, 2018, 10:31am UTC](https://community.thunkable.com/t/import-database-file-sql/37157/14 "2018-07-23T10:31:17Z")

</div>

1. the Entire text of the file copy in a text box
2. Then in the loop you need to obtain the desired entries in the list
3. the list to display in List Viewer and make event processing when you select a list item

If you do not understand this algorithm, during the day I’ll try to make a simple example.

---

<div class="post-metadata">

**Author:** ![Milan\_Ghevariya](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/milan_ghevariya/32/23690_2.png) [@Milan\_Ghevariya](https://community.thunkable.com/u/Milan_Ghevariya)\
**Post date:** [July 23, 2018, 10:32am UTC](https://community.thunkable.com/t/import-database-file-sql/37157/15 "2018-07-23T10:32:40Z")

</div>

please give me one example

Thank you so much.

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [July 23, 2018, 11:35am UTC](https://community.thunkable.com/t/import-database-file-sql/37157/16 "2018-07-23T11:35:09Z")

</div>

Check it.

1. [https://csvjson.com/sql2json](https://csvjson.com/sql2json) I converted .sql to json
2. Сopy the result in the data and remove unwanted data from JSON (you can leave them, but then the algorithm will be more difficult)
3. Created from JSON data list and made handler for selecting list item

[https://x.thunkable.com/projects/5b53152859e51a188b6b060d/project/properties/designer/](https://x.thunkable.com/projects/5b53152859e51a188b6b060d/project/properties/designer/)

---

<div class="post-metadata">

**Author:** ![Milan\_Ghevariya](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/milan_ghevariya/32/23690_2.png) [@Milan\_Ghevariya](https://community.thunkable.com/u/Milan_Ghevariya)\
**Post date:** [July 23, 2018, 11:50am UTC](https://community.thunkable.com/t/import-database-file-sql/37157/17 "2018-07-23T11:50:31Z")

</div>

so tell me inthis screen shot, i will which data put to in the block ?/ please help me

 ![Screenshot1](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/f/df1b5b317b86a4d8d0d25361f562691c4ec4d10d.png)

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [July 23, 2018, 11:53am UTC](https://community.thunkable.com/t/import-database-file-sql/37157/18 "2018-07-23T11:53:48Z")

</div>

Put all data json and then removed unnecessary symbols.

All source JSON

```
{
  "continents": [
    {
      "code": "AF",
      "name": "Africa"
    },
    {
      "code": "AN",
      "name": "Antarctica"
    },
    {
      "code": "AS",
      "name": "Asia"
    },
    {
      "code": "EU",
      "name": "Europe"
    },
    {
      "code": "NA",
      "name": "North America"
    },
    {
      "code": "OC",
      "name": "Oceania"
    },
    {
      "code": "SA",
      "name": "South America"
    },
    {
      "code": "??",
      "name": null
    }
  ]
}

```

JSON in the block

```
    {
      "code": "AF",
      "name": "Africa"
    },
    {
      "code": "AN",
      "name": "Antarctica"
    },
    {
      "code": "AS",
      "name": "Asia"
    },
    {
      "code": "EU",
      "name": "Europe"
    },
    {
      "code": "NA",
      "name": "North America"
    },
    {
      "code": "OC",
      "name": "Oceania"
    },
    {
      "code": "SA",
      "name": "South America"
    },
    {
      "code": "??",
      "name": null
    }
```

---

<div class="post-metadata">

**Author:** ![Milan\_Ghevariya](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/milan_ghevariya/32/23690_2.png) [@Milan\_Ghevariya](https://community.thunkable.com/u/Milan_Ghevariya)\
**Post date:** [July 23, 2018, 11:56am UTC](https://community.thunkable.com/t/import-database-file-sql/37157/19 "2018-07-23T11:56:35Z")

</div>

in this how to i set next and previous button

so user see one by one text

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [July 23, 2018, 11:58am UTC](https://community.thunkable.com/t/import-database-file-sql/37157/20 "2018-07-23T11:58:05Z")

</div>

To do this, output the data not in the List Viewer, but in the Label. Add buttons to navigate through the list entries list.

[Next page](https://community.thunkable.com/t/import-database-file-sql/37157.md?page=2)
