# Exporting a Segment As a File

This procedure assumes that Parent Segment and a batch Segment exist.

1. Open Treasure Console.
2. Navigate to Audience Studio and select the target Segment
3. Click `Edit segment rules` button in `Rules` tab
![Tabs for the Segment](/assets/exporting-a-segment-as-a-file_image0.813f975bbb4fcaea7cf88d005d7477925a1fa069081bb0ad5dbb539c5fc3afb5.cf3845cb.png)
4. Click the icon like `< >`
![Segment Builder](/assets/exporting-a-segment-as-a-file_image1.3e65d690db26b91875b48626abd27da6fc62cb15fe38fdf7ccffe84992bf7280.cf3845cb.png)
5. Click `Copy SQL Code` button
![Query statement for the Segment](/assets/exporting-a-segment-as-a-file_image2.1332fa0ad0708da04deffbbf4001f4f29113e3252d0e585cf66d53f1486e88de.cf3845cb.png)
6. Open Query Editor and past the query statement
It is recommended that you set the databse described in the query statement for the query.
![Query Editor with the query statement for Segment](/assets/exporting-a-segment-as-a-file_image2.1332fa0ad0708da04deffbbf4001f4f29113e3252d0e585cf66d53f1486e88de.cf3845cb.png)
7. If you run the query statement with Trino, you will retrieve the content of the Segment