Dies ist eine alte Version des Dokuments!


LU07a - SQL-DML: Basics

  1. Understand and Apply Data Insertion Concepts
  2. Master the Use of UPDATE Statements with Filters
  3. Safely Delete Records Using SQL DELETE Statements:
  4. Demonstrate Practical Usage of SQL DML in Real-world Scenarios

To beginn with, the acronym DML stands for Data Manipulation Language and refers to how table contents are to be handled according to the rules of a relational database system such as MySQL.

MySQL DML is used to manage the data in tables, as opposed to the structure of the tables themselves. The three main operations are:

  1. INSERT: Used to add new records to a table.
  2. UPDATE: Modifies existing data within a table.
  3. DELETE: Removes data from a table.

Each of these commands can be executed with or without filtering conditions, affecting either specific rows or all rows within a table.

The INSERT command is used to add new records to a table. When using INSERT, it is essential to specify the table and columns where the data will be added.

Syntax

INSERT INTO table_name (column1, column2, column3) 
VALUES (value1, value2, value3);

Example

INSERT INTO employees (employee_id, first_name, last_name, hire_date, salary) 
VALUES (1, 'John', 'Doe', '2023-09-18', 55000);

The UPDATE command is used to modify existing data in a table. It can be executed with or without a WHERE clause, depending on whether you want to update specific rows or all rows.

2.1 UPDATE with Filter (WHERE Clause)

Using a WHERE clause allows you to target specific rows to update. This ensures that only rows meeting a certain condition are modified.

Syntax

UPDATE table_name 
SET column1 = value1, column2 = value2 
WHERE condition;

Example

UPDATE employees 
SET salary = 60000 
WHERE employee_id = 1;
English Deutsch
to refer to beziehen auf
according gemäss
opposed to im Gegensatz zu

Volkan Demir

  • modul/m290/learningunits/lu07/theorie/01.1727689045.txt.gz
  • Zuletzt geändert: 2024/09/30 11:37
  • von vdemir