1
CREATE TABLE Cliente (
id_Cliente INTEGER PRIMARY KEY IDENTITY(1,1),
nome_Cliente VARCHAR(50),
fk_ID_Telefone INTEGER
)
CREATE TABLE Telefone (
id_Telefone INTEGER PRIMARY KEY IDENTITY(1,1),
fone_Telefone VARCHAR(11)
)
1
CREATE TABLE Cliente (
id_Cliente INTEGER PRIMARY KEY IDENTITY(1,1),
nome_Cliente VARCHAR(50),
fk_ID_Telefone INTEGER
)
CREATE TABLE Telefone (
id_Telefone INTEGER PRIMARY KEY IDENTITY(1,1),
fone_Telefone VARCHAR(11)
)
-1
Making a INSERT
with SELECT
:
INSERT INTO Cliente (fk_ID_Telefone) SELECT id_Telefone FROM Telefone
But if it’s a UPDATE
with SELECT
:
UPDATE Cliente a
JOIN Telefone b
SET a.fk_ID_telefone=b.id_Telefone
Browser other questions tagged sql sql-server
You are not signed in. Login or sign up in order to post.
when asking a question see how to format it to get more organized.
– Edu Mendonça
As stated in the answer you can make a
insert
withselect
but for that you must specify to which customer that phone belongs. I don’t know if that’s really what you want. Try explaining again what you need and demonstrate through examples.– Caique Romero