Page 1 of 2 12 LastLast
Results 1 to 20 of 23

Thread: Delete values in single a row without using DELETE keyword.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Geek_Guest
    Guest

    Delete values in single a row without using DELETE keyword.

    Is it possible to delete the values in single a row without using DELETE keyword....If so whats the Query

    Question asked by visitor P.PRAVEEN KUMAR


  2. #2
    Junior Member
    Join Date
    May 2007
    Answers
    6

    Re: Delete values in single a row without using DELETE keyword.

    update 'tablename' set value=null where 'any unique id'

    I thought by this we can delete values....


  3. #3
    Expert Member
    Join Date
    Jun 2006
    Answers
    410

    Re: Delete values in single a row without using DELETE keyword.

    I don't understand the term "delete the values in single a row"...

    give us an example


  4. #4
    Junior Member
    Join Date
    Jun 2007
    Answers
    1

    Re: Delete values in single a row without using DELETE keyword.

    hello every one
    i'm new here i want to become an active part of Geeks Talk but i don't know how so i try with sql i find it so hard iwant learn may be my language is not that good to yndeastand the select andd insert statements i don't know why ?
    wuld any one can help make me professional in the sql


  5. #5
    Junior Member
    Join Date
    May 2007
    Answers
    1

    Re: Delete values in single a row without using DELETE keyword.

    hi
    these r the basic questions in sql.
    for removing the rows there r two options..
    delete is a dml command u can rollback the values
    truncat is dml command u cant rollback the values


  6. #6
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Thumbs up Re: Delete values in single a row without using DELETE keyword.

    Quote Originally Posted by satish.paluvai View Post
    hi
    these r the basic questions in sql.
    for removing the rows there r two options..
    delete is a dml command u can rollback the values
    truncat is dml command u cant rollback the values
    TRUNCATE is not a DML ,it is a DDL command because it changes the structure of the table not only data. and DDL commands can't be rolledback.

    TRUNCATE deletes all the records from a table ,so can't be used for deleting a particular record.


  7. #7
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Re: Delete values in single a row without using DELETE keyword.

    u can update the fields by null but it will create another problem. the data is removed but the row is still there (a row of null records).


  8. #8
    Junior Member
    Join Date
    May 2007
    Answers
    6

    Re: Delete values in single a row without using DELETE keyword.

    I thought the question mentioning about values not deleting row or any other thing... So, I hope it may be good one...


  9. #9
    Junior Member
    Join Date
    Sep 2007
    Answers
    3

    Re: Delete values in single a row without using DELETE keyword.

    Creating a table, and inserting everything except that row.
    Generally in data warehousing (some tools are not good with delete statement, like teradata). At that in case you have to delete or update huge part of the table, this is better scenerio to do it.
    I hope this helped.

    Cheers,
    Shilpa.


  10. #10
    Junior Member
    Join Date
    Feb 2007
    Answers
    26

    Re: Delete values in single a row without using DELETE keyword.

    hello,
    well yeah the update will change the values to null a sort of delete but when u ll view the table still that row exists so that does not implies that anything got deleted. still a good attempt


  11. #11
    Junior Member
    Join Date
    Feb 2007
    Answers
    1

    Re: Delete values in single a row without using DELETE keyword.

    If we are not going to use Delete we could just reset the values to Null or Missing. If we wanted to delete the entire ROW than we would have to be a bit more clever.

    In this case, something like this should work:

    UPDATE myTable Set field1 = "", field2 = "", field3 = "" where ROWID = 123;

    I hope this is what you were looking for.


  12. #12
    Junior Member
    Join Date
    Aug 2007
    Answers
    15

    Re: Delete values in single a row without using DELETE keyword.

    Though what many of you have suggested i.e. to update the values to NULL sounds fine, but the problem will arise while updating the primary key column value, since a NULL value in that case isn't allowed.

    What say !!!


  13. #13
    Junior Member
    Join Date
    Sep 2007
    Answers
    6

    Re: Delete values in single a row without using DELETE keyword.

    [QUOTE=Geek_Guest;13761]Is it possible to delete the values in single a row without using DELETE keyword....If so whats the Query

    Question asked by visitor P.PRAVEEN KUMAR[/QUOTE

    as per my knowledge it is not possible.u can updatae values by using the update command.


  14. #14
    Junior Member
    Join Date
    May 2007
    Answers
    6

    Re: Delete values in single a row without using DELETE keyword.

    Hi Shilpha,
    Good. But, I have one doubt can you clear it. If previous table was refered by some other tables means what will happen. If any wrong, How can we rectify that.

    eg :
    As per your thought,

    old table
    Student(Rollno,Name,Address)

    new table
    StudentDetails(Rollno,Name,Address)

    See here other tables refering 'Student' table
    1. Marks
    2. Sports


  15. #15
    Junior Member
    Join Date
    Sep 2007
    Answers
    3

    Re: Delete values in single a row without using DELETE keyword.

    Nice question mikerich135
    According to me this technique will work well in case of data warehouse where u generally have no referencial integrity or soft referential integrity (where there is just a subtable maintained for errors and its never enforced).

    But if in case we thought abt databases where referencial integrity is a big contraint then another approach can be adding a new column in table which maintains active/inactive.

    Cheers,
    Shilpa.


  16. #16

    Re: Delete values in single a row without using DELETE keyword.

    Quote Originally Posted by Geek_Guest View Post
    Is it possible to delete the values in single a row without using DELETE keyword....If so whats the Query

    Question asked by visitor P.PRAVEEN KUMAR


    Wht u want exactly???

    U can use Truncate ...

    It deletes all values premanently....


  17. #17
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Re: Delete values in single a row without using DELETE keyword.

    Quote Originally Posted by anandhimanickam View Post
    Wht u want exactly???

    U can use Truncate ...

    It deletes all values premanently....
    Truncate command deletes all the data from the table ,not of a single row.


  18. #18
    Junior Member
    Join Date
    Sep 2007
    Answers
    1

    Re: Delete values in single a row without using DELETE keyword.

    I also want to know abt. it.


  19. #19
    Junior Member
    Join Date
    Aug 2007
    Answers
    7

    Re: Delete values in single a row without using DELETE keyword.

    It is not possible bcoz if u updating table then data are deleted but still is remaining with null data & if u used Truncate then it delete records for premanently


  20. #20
    Junior Member
    Join Date
    Aug 2006
    Answers
    3

    Re: Delete values in single a row without using DELETE keyword.

    You can create another table with the same structure and insert the rows which are satisfying your conditions i.e. Leave all the rows which you want to delete.


    E.g. Original table - A new table - B (structure same as a)


    insert into b select * from a where


    cheers! umesh

    Last edited by manglani2004; 09-27-2007 at 12:23 AM. Reason: formatting

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact