# How to delete all records

**URL:** <https://forum.code.org/t/how-to-delete-all-records/18001>\
**Category:** CS Principles\
**Created:** [July 25, 2018, 3:01pm UTC](https://forum.code.org/t/how-to-delete-all-records/18001 "2018-07-25T15:01:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dsawyer](https://avatars.discourse-cdn.com/v4/letter/d/f05b48/32.png) [@dsawyer](https://forum.code.org/u/dsawyer)\
**Post date:** [July 25, 2018, 3:01pm UTC](https://forum.code.org/t/how-to-delete-all-records/18001/1 "2018-07-25T15:01:46Z")

</div>

Hi All. I’m playing with the Data Tools section and want to have a button that clears the table i.e. deletes all the records. I can do it using a loop but wonder if there’s a shorter way.

---

<div class="post-metadata">

**Author:** ![frank\_w\_lee](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/frank_w_lee/32/4895_2.png) [@frank\_w\_lee](https://forum.code.org/u/frank_w_lee)\
**Post date:** [July 26, 2018, 6:39am UTC](https://forum.code.org/t/how-to-delete-all-records/18001/2 "2018-07-26T06:39:07Z")

</div>

Hi @dsawyer,

I’m not sure exactly what you’re referring to, but it sounds like you’re talking about App Lab, and that using the green Data blocks, you’ve created a table with multiple records, and you want to delete all the records all at once instead of repeatedly using the “deleteRecord” command and deleting one at a time.

Assuming that’s the case, I don’t believe there’s a way. I’ll check with [code.org](http://code.org) staff and if that’s not the case, I or a [code.org](http://code.org) staff member will post an update here.

Frank

---

<div class="post-metadata">

**Author:** ![dsawyer](https://avatars.discourse-cdn.com/v4/letter/d/f05b48/32.png) [@dsawyer](https://forum.code.org/u/dsawyer)\
**Post date:** [July 26, 2018, 11:46am UTC](https://forum.code.org/t/how-to-delete-all-records/18001/3 "2018-07-26T11:46:21Z")

</div>

​Hi,

Sorry for not being clearer. Yes, I’m in App Lab and using the green Data blocks and want to delete all the records at once. I was able to figure out how to do it using a loop but it felt a little clumsy. Is there a way to use SQL commands with the table?

Don Sawyer

Computer Science and Mathematics Teacher

MHS Robotics Club Sponsor

Methacton High School

---

<div class="post-metadata">

**Author:** ![baker](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/baker/32/1229_2.png) [@baker](https://forum.code.org/u/baker)\
**Post date:** [July 26, 2018, 1:04pm UTC](https://forum.code.org/t/how-to-delete-all-records/18001/4 "2018-07-26T13:04:03Z")

</div>

Hi Don,

I’ll ask internally – I could have sworn that there was a syntax you could use with a wildcard character, or just an empty object, to delete everything but I guess not. I also have a recollection that there were security/stability issues with doing that potentially.

So yeah, you gotta loop it. Only way I found right now.

–Baker  
CSP Team
