PLATFORM
  • Tails

    Create websites with TailwindCSS

  • Blocks

    Design blocks for your website

  • Wave

    Start building the next great SAAS

  • Pines

    Alpine & Tailwind UI Library

  • Auth

    Plug'n Play Authentication for Laravel

  • Designer comingsoon

    Create website designs with AI

  • DevBlog comingsoon

    Blog platform for developers

  • Static

    Build a simple static website

  • SaaS Adventure

    21-day program to build a SAAS

Delete * FROM TABLE

DELETE FROM table_name
WHERE id IS NOT NULL

There may come a time when you need to delete all rows from a database table.

In the event that you can do this you could simple write the following statement:

DELETE FROM table_name
WHERE id IS NOT NULL

Of course this assumes that you have an id field in your table. If your table does not have an id column you could run this across another column:

DELETE FROM table_name
WHERE column IS NOT NULL

And of course this is only going to delete all records where that column is not null, so if you run this using a column that does not allow null, you can be gauranteed that it will remove all columns from that table.

BETA Snippet explanation automatically generated by OpenAI:

No explanation generated yet.

Snippet By Dev Dojo

ยท

Created June 12th, 2021

ยท

Report Snippet