Search
 
SCRIPT & CODE EXAMPLE
 

SQL

copy column data to another column sql with creating slugs

## Add New Column then UPDATE Old Table Data to New table with Slug type

## Syntax
ALTER TABLE `tblname` ADD `column_slug` VARCHAR(255) NOT NULL AFTER `column_name`;
UPDATE `tblname` SET `column_slug` = replace(lower(column_name), ' ', '-');

## Example
ALTER TABLE `product` ADD `product_slug` VARCHAR(255) NOT NULL AFTER `productname`;
UPDATE `product` SET `product_slug` = replace(lower(productname), ' ', '-');
Comment

PREVIOUS NEXT
Code Example
Sql :: add column in mysq 
Sql :: how to check data type in sql server 
Sql :: how to give user privelege to create dblink in oracle 
Sql :: update mysql centos 
Sql :: mysql created at yesterdau 
Sql :: add constraint fk 
Sql :: String concatenation in PostgreSQL 
Sql :: SELECT User,Host FROM mysql.user; 
Sql :: postgres delete last row 
Sql :: oracle sql query to make column data uppercase 
Sql :: mysql set root password 
Sql :: how to check database size mysql 
Sql :: invalid reference to FROM-clause entry for table "unidades 
Sql :: add many column to sap iq table 
Sql :: create email address from first and last name in sql 
Sql :: dirinfo.name my snippets in stored procedure 
Sql :: mysql date format unix timestamp 
Sql :: operator does not exist: integer = text 
Sql :: apex ORA-20999 
Sql :: postgres show current role 
Sql :: reutrn string after character sql 
Sql :: display total number of tables in mysql 
Sql :: sql server loop over query 
Sql :: postgresql add alter permissions to role 
Sql :: mysql search like order by best match 
Sql :: clear screen command in psql 
Sql :: mysql shell ERROR: Not connected. 
Sql :: sql alter table statement 
Sql :: sql alchemy with azuresql server 
Sql :: sql if null then 0 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =