Fundamentos de Bases de datos

1

C贸mo dise帽ar bases de datos y hacer queries efectivos

2

C贸mo identificar y organizar datos en bases de datos

3

Introducci贸n pr谩ctica a SQL y bases de datos relacionales

4

Trabajo Directo con MySQL: Cliente, Servidor y Manejo de Errores

5

Instalaci贸n de MySQL en varios sistemas operativos

Quiz: Fundamentos de Bases de datos

Introducci贸n a Bases de Datos Relacionales

6

Conceptos b谩sicos de bases de datos: columnas, tuplas y relaciones

7

Creaci贸n de Tablas en MySQL con Tipos de Datos Esenciales

8

Creaci贸n de tablas en MySQL con Primary Key y Timestamp

9

Normalizaci贸n y relaciones en bases de datos relacionales

10

Creaci贸n y visualizaci贸n de bases de datos con DBML y DBDiagram

Quiz: Introducci贸n a Bases de Datos Relacionales

Manipulaci贸n de Datos

11

C贸mo crear tablas y utilizar 'Foreign Keys' en MySQL

12

Crear tablas y establecer llaves for谩neas en SQL

13

Tipos de tablas en una base de datos relacional

14

C贸mo Modificar Tablas en SQL con ALTER TABLE

15

C贸mo Insertar Datos y Manejar Errores en MySQL

16

Creaci贸n Avanzada de una Tabla Products en MySQL

17

Uso pr谩ctico del WHERE en SQL para filtrar datos con precisi贸n

18

Gu铆a pr谩ctica para modificar datos usando UPDATE en SQL

19

C贸mo eliminar datos en SQL: m茅todos l贸gicos y f铆sicos

20

Uso Avanzado del Comando SELECT en SQL

Quiz: Manipulaci贸n de Datos

Agrupaci贸n de Datos

21

Funciones agregadoras en MySQL para an谩lisis eficiente de datos

22

Insertar datos desde otra tabla en MySQL con Insert Into Select

23

C贸mo utilizar Left Join en bases de datos relacionales

24

C贸mo consultar y relacionar tablas en MySQL

You don't have access to this class

Keep learning! Join and start boosting your career

Aprovecha el precio especial y haz tu profesi贸n a prueba de IA

Antes: $249

Currency
$209
Suscr铆bete

Termina en:

0 D铆as
6 Hrs
58 Min
26 Seg

Insertar datos desde otra tabla en MySQL con Insert Into Select

22/24
Resources

Learning how to correctly use the SQL INSERT INTO SELECT statement is essential to optimize data manipulation in MySQL databases. This statement allows you to fill a new table with data from another existing table, facilitating tasks and improving efficiency.

How to create a table to store investments in MySQL?

Creating a specific table, such as investment, makes it easy to store data related to the capital invested in products. The table is clearly defined with the following attributes:

CREATE  TABLE investment  (  investmentID INT UNSIGNED PRIMARY  KEY AUTO_INCREMENT,  productID INT UNSIGNED NOT  NULL,  investment INT NOT  NULL DEFAULT  0);

It is essential to precisely define each column, correctly establishing data types and restrictions to ensure the integrity and efficiency of the information storage.

What does the Insert Into Select statement consist of?

The INSERT INTO SELECT statement combines two processes into one, filling the newly created table with information extracted directly from another existing table in a simple, fast and orderly manner:

INSERT INTO investment (productID, investment)SELECT productID, stock  * price FROM products;

Important aspects are:

  • The VALUES keyword is not used.
  • The corresponding columns between the two tables are specified.
  • The selected query(SELECT) defines the values to be inserted.

This method guarantees speed and transparency in data transfer.

How to verify and analyze the maximum investments?

Once the data has been inserted, it is easy to perform specific analyses, such as identifying the products with the highest investments by applying descending order and limiting the results:

SELECT  * FROM investmentORDER BY investment DESCLIMIT 10;

To obtain complete information about a specific product highlighted in the analysis, the following is employed:

SELECT  * FROM productsWHERE productID  = 1208;

These analyses serve to clearly identify where the largest investments are concentrated and to decide strategically on the management of capital in specific products.

If you would like to learn more or clarify specific aspects of the INSERT INTO SELECT statement, feel free to leave your comments or questions below.

Contributions 0

Questions 0

Sort by:

Want to see more contributions, questions and answers from the community?