sql-delete Flashcards

1
Q

How do you delete rows from a database table?

A

Using the “delete from” clause. On the next line, enter the “where” clause followed by the name of the column in double quotes, followed by the operator, followed by the name of the value in single quotes.

delete from (name of table in double quotes)
  where (name of column in double quotes) = (name of value in single quotes)
returning *;  (this part is optional)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you accidentally delete all rows from a table?

A

Using “delete from (name of table);” without the “where” clause.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly