Sunday, January 11, 2009

Modifying Row Data

/* Create the table */
Drop TABLE Professor;

CREATE TABLE Professor (
ProfessorID INT NOT NULL PRIMARY KEY,
Name VARCHAR(50) NOT NULL)
TYPE = InnoDB;

/* Prepare the data */
INSERT INTO Professor (ProfessorID,Name) VALUES (1,'John Jones');
INSERT INTO Professor (ProfessorID,Name) VALUES (2,'Cury Butz');
INSERT INTO Professor (ProfessorID,Name) VALUES (3,'JJ Smith');


/* Real command */

UPDATE Professor
SET Name = CONCAT('Prof. ', Name)
WHERE ProfessorID > 6;

0 comments:

Followers

The Daily Puppy

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | JCPenney Coupons