How can I delete a particular row from the table in a SQLquery

老子叫甜甜 提交于 2019-12-13 09:54:39

问题


How can I delete a particular row from the table in a SQLquery. I used primary key and Foreign key in this table. I am using Oracle 11G.


回答1:


its very simple, may be you need some reference: http://psoug.org/reference/delete.html

DELETE FROM table_name WHERE columnname= 'value';




回答2:


you asking to delete column Right? update employee set city_name = '' where empid = '12'

Try this... This will make the column to NULL




回答3:


Consider this example

You are having a table named cars columns are car_id, car_model, car_colour

car_id           car_model         car_colour
 234              hyundai           red
 345              Nano              white
 565              Maruthi           black
 888              BMW               brown
 895              Audi              Blue
 234              hyundai           red_blue
 345              Nano              white_yellow
 565              Maruthi           black_shade
 888              BMW               brown_king
 895              Audi              Blue_red

now here you want to delete the brown_king colour row, then you want to type the below query

delete from table_name where column_name = 'condition'

delete from cars where car_colour ='brown_king'

This will delete that particular row in this table.



来源:https://stackoverflow.com/questions/17082580/how-can-i-delete-a-particular-row-from-the-table-in-a-sqlquery

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!