if you want to delete data in mysql table than use following syntax
Syntax:-
DELETE FROM table_name WHERE position_of_row;
Note:-
# Entire row will be deleted.
# Position of row is required, because if you forget to write position_of_row than mysql will delete entire table.
Example:-
homeno | homename | state | country |
206 | chiguru | karnataka | india |
27 | sri ram | goa | india |
20 | krish | kerala | india |
If you want to delete homeno 27 than syntax will be
DELETE FROM homedetails WHERE homeno=27;
homeno | homename | state | country |
206 | chiguru | karnataka | india |
20 | krish | kerala | india |
2. same homeno
homeno | homename | state | country |
206 | chiguru | karnataka | india |
20 | sri ram | kerala | india |
20 | krish | punjab | pakistan |
DELETE FROM homedetails WHERE state='punjab' and country='pakistan';
homeno | homename | state | country |
206 | chiguru | karnataka | india |
20 | sri ram | kerala | india |
3. Delete all rows
Syntax:-
DELETE FROM table_name;
or
DELETE * FROM table_name;
Example:-
DELETE FROM homedetails;
homeno | homename | state | country |
Leave reply
Add your comments here