The database includes a table with a rows: html/css/java/php
How with sql query delete "java"?
The result would be: html/css/php
The database includes a table with a rows: html/css/java/php
How with sql query delete "java"?
The result would be: html/css/php
See http://www.w3schools.com/sql/sql_delete.asp for details on DELETE
.
DELETE FROM TableName WHERE yourColumn = 'java'
I'm not entirely sure what you're asking, because your question isn't very clear.
If "html", "css", "java", and "php" are different values for the same column, this is what you want:
DELETE FROM table_name WHERE column_name = 'java';
You'll need to replace "table_name" with the name of your table and "column_name" with the name of your column.
I'm not sure what you want to achieve... If you need to delete column 'java', it should look like
ALTER TABLE table1 DROP COLUMN java
If there are 4 rows then Aioobe's answer would hold good. If you want to update the column but leave out Java then you should use:
UPDATE table_name SET column_name = Replace(column_name,'java/','')
IF you want to retrieve the information leaving out that data then use:
SELECT Replace(column_name,'java/','') column_name FROM table_name
HTH
Here's another guess:
SQL> select * from t23
2 /
WHATEVER
----------------------------------------------------------------
html/css/java/php
SQL> update t23
2 set whatever = replace(whatever, '/java', null)
3 where whatever like '%/java%'
4 /
1 row updated.
SQL> select * from t23
2 /
WHATEVER
----------------------------------------------------------------
html/css/php
SQL>
There are other ways to do the same thing. For instance some flavours of database support using RegEx in a similar fashion
try this (SQL Server syntax, question does not specify which database):
DECLARE @YourTable table (YourColumn varchar(500))
INSERT INTO @YourTable VALUES ('html/css/java/php')
INSERT INTO @YourTable VALUES ('html/css/java')
INSERT INTO @YourTable VALUES ('java/php')
INSERT INTO @YourTable VALUES ('java')
INSERT INTO @YourTable VALUES ('html/css/php')
UPDATE @YourTable
SET YourColumn=REPLACE(
REPLACE(
REPLACE(YourColumn,'/java','')
,'java/',''
)
,'java',''
)
select * from @YourTable
OUTPUT
YourColumn
-------------------
html/css/php
html/css
php
html/css/php
(5 row(s) affected)