SQL - how to create a column based on other columns

Hey! this is my current script below.
I want to add in a statement that changes the email column for all rows to equal a combination of the name column and ‘.com’ - how would I do this?

CREATE TABLE friends (
name TEXT,
birthday DATE

INSERT INTO friends (id, name, birthday)
VALUES(1, ‘Ororo Munroe’, ‘1940-05-30’);

INSERT INTO friends (id, name, birthday)
VALUES(2, ‘x’, ‘1999-01-01’);

INSERT INTO friends (id, name, birthday)
VALUES(3, ‘y’, ‘2005-01-01’);

UPDATE friends
SET name = ‘storm’
WHERE id=1;

name = REPLACE(name,‘y’,‘stormtrooper’)
id <4;

FROM friends;

If it is purely on the output without manipulating the actual data, then you need an interface that presents the data, whereupon you can introduce format and layout, in your own presentational manner. In other words, we cannot inject data into a query response, only in the finalized report that will require another layer of software.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.