0% found this document useful (0 votes)
25 views1 page

(Not Null, Null, Null) : #Productosresumen Idproducto Nombre Precio

The document contains SQL statements that create a temporary table to insert product data from another table, inserts sales representative data from an employees table, and selects employee data from multiple tables and inserts it into a new table.

Uploaded by

Jorge Arcadio
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views1 page

(Not Null, Null, Null) : #Productosresumen Idproducto Nombre Precio

The document contains SQL statements that create a temporary table to insert product data from another table, inserts sales representative data from an employees table, and selects employee data from multiple tables and inserts it into a new table.

Uploaded by

Jorge Arcadio
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

CREATE TABLE #ProductosResumen

( idProducto int NOT NULL PRIMARY KEY,


nombre varchar(75) NULL,
precio smallmoney NULL
);

Insertando datos en la tabla temporal global.

INSERT #ProductosResumen (idProducto, nombre , precio)


SELECT id,nombre, precio FROM dbo.DEMO_PRODUCTO
ORDER BY nombre;

INSERT INTO repres (numemp, oficinarep, nombrerep) SELECT numemp, oficina,


nombre FROM empleados WHERE titulo = 'rep ventas'

USE AdventureWorks;
GO
SELECT c.FirstName, c.LastName, e.Title, a.AddressLine1, a.City, sp.Name AS
[State/Province], a.PostalCode
INTO dbo.EmployeeAddresses
FROM Person.Contact AS c
JOIN HumanResources.Employee AS e ON e.ContactID = c.ContactID
JOIN HumanResources.EmployeeAddress AS ea ON ea.EmployeeID = e.EmployeeID
JOIN Person.Address AS a on a.AddressID = ea.AddressID
JOIN Person.StateProvince as sp ON sp.StateProvinceID = a.StateProvinceID;
GO

You might also like