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

Updating rows

SQL Lesson 14

Para actualizar información en la base de datos utilizamos UPDATE.

Debemos especificar exactamente qué tabla, columnas y filas queremos actualizar, además de las restricciones que necesitemos aplicar con WHERE.

UPDATE mytable 
SET column = value_or_expr, 
	other_column = another_value_or_expr, 
	… 
WHERE condition;

Corregir los siguientes errores:

  1. El director de "A Bug's Life" es incorrecto, en realidad fue dirigido por John Lasseter.

UPDATE movies
SET director = 'John Lasseter'
WHERE title = "A Bug's Life";
  1. El año en que se lanzó "Toy Story 2" es incorrecto, en realidad se lanzó en 1999.

UPDATE movies
SET year = 1999
WHERE title = 'Toy Story 2';
  1. Tanto el título como el director de Toy Story 8 son incorrectos. El título debería ser "Toy Story 3" y fue dirigida por Lee Unkrich.

UPDATE movies
SET title = 'Toy Story 3',
    director = 'Lee Unkrich'
WHERE title = 'Toy Story 8';
PreviousInserting rowsNextDeleting rows

Last updated 1 year ago