stamin4
  • whoami
  • HTB Academy
    • Introduction to Academy
    • Learning Process
    • Vulnerability Assessment
    • Web Requests
    • Introduction to Networking
    • Linux Fundamentals
    • Brief Intro to Hardware Attacks
    • Setting Up
    • Using the Metasploit Framework
    • Security Incident Reporting
    • Introduction to Web Applications
    • JavaScript Deobfuscation
    • Attacking Web Applications with Ffuf
    • Windows Fundamentals
    • File Inclusion
  • HTB Machines
    • Windows
      • 🟢Easy
      • 🟠Medium
      • 🔴Difficult
      • 🟣Insane
    • Linux
      • 🟢Easy
        • Cap
      • 🟠Medium
      • 🔴Difficult
      • 🟣Insane
  • OverTheWire
    • Bandit
      • Nivel 0
      • Nivel 1
      • Nivel 2
      • Nivel 3
      • Nivel 4
      • Nivel 5
      • Nivel 6
      • Nivel 7
      • Nivel 8
      • Nivel 9
      • Nivel 10
  • Base de datos
    • SQL
      • SELECT queries 101
      • Queries with constraints (Pt. 1)
      • Queries with constraints (Pt. 2)
      • Filtering and sorting Query results
      • Simple SELECT Queries
      • Multi-table queries with JOINs
      • OUTER JOINs
      • A short note on NULLs
      • Queries with expressions
      • Queries with aggregates (Pt. 1)
      • Queries with aggregates (Pt. 2)
      • Order of execution of a Query
      • Inserting rows
      • Updating rows
      • Deleting rows
      • Creating tables
      • Altering tables
      • Dropping tables
  • PortSwigger
    • Path Traversal
  • Dockerlabs
    • Trust
    • Firsthacking
    • Upload
Powered by GitBook
On this page
  1. Base de datos
  2. SQL

Inserting rows

SQL Lesson 13

Utilizamos INSERT para añadir información a la base de datos.

INSERT INTO mytable 
VALUES (value_1, value_2 …), 
(another_value_1, another_value_2, …), 
(…);

Por lo general, la información que insertamos debe tener todos los valores correspondientes a cada columna en la tabla. Sin embargo, si tenemos valores por defecto, los podemos omitir.


  1. Añade Toy Story 4 a la lista de películas.

INSERT INTO movies (title,director,year,length_minutes)
VALUES ('Toy Story 4','Josh Cooley',2019,100);
  1. ¡Toy Story 4 ha sido lanzado con gran éxito de crítica! Tuvo una calificación de 8.7 e hizo 340 millones a nivel nacional y 270 millones a nivel internacional. Agrega el registro a la tabla BoxOffice.

INSERT INTO boxoffice (movie_id, rating, domestic_sales,international_sales)
VALUES (15,8.7,340000000,270000000);
PreviousOrder of execution of a QueryNextUpdating rows

Last updated 1 year ago