Link to home
Start Free TrialLog in
Avatar of SuperJinx
SuperJinx

asked on

How to delete records from a table in pure SQL?

I have been playing around with the insert statement in my SQL, i looked at my table and noticed that i have got 8 records for one person and 8 records for another person both of whom i used the insert statement for numerous times, obviously i only want one record for each person.

I tried to use logic, and tried DELETE * FROM Person WHERE FirstName = 'Jack Lumsdon'

&

                                             DELETE * FROM Person WHERE FirstName IS =('Jack Lumsdon')

But to no avail. I get a red squiggly line underneath the * and the error message Incorrect syntax '*'.

Any ideas of how i can get my table to delete these and bring me back down to just one record for each person.

Thanks!
Avatar of mwochnick
mwochnick
Flag of United States of America image

try DELETE FROM Person WHERE FirstName = 'Jack Lumsdon'
Avatar of SuperJinx
SuperJinx

ASKER

No joy! in the message's also says 0 records affected
ASKER CERTIFIED SOLUTION
Avatar of RehanYousaf
RehanYousaf
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Your example has a first and a last name in the quotes.  Is the table splitting name up into two columns perhaps and you need to specifiy FirstName = 'Jack' AND LastName = 'Lumsdon' in your WHERE clause?
Nice one dude, that sorted it out for me!
Cheers!
to display the table structure execute a describe statement on the person table

describe person