Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
modul:m290:learningunits:lu07:theorie:01 [2024/09/30 12:03] – [Overview of MySQL DML] vdemirmodul:m290:learningunits:lu07:theorie:01 [2024/10/17 12:46] (aktuell) vdemir
Zeile 1: Zeile 1:
-====== LU07a - SQL-DML: Basics ====== +====== LU08a - SQL-DML: Basics ======
-**Sources**  +
-  - [[https://www.w3schools.com/sql/sql_insert.asp | W3Schools | INSERT INTO ]] +
-  - [[https://www.w3schools.com/sql/sql_update.asp | W3Schools | UPDATE ]] +
-  - [[https://www.w3schools.com/sql/sql_delete.asp | W3Schools | DELETE ]]+
  
 ===== Learning Objectives ===== ===== Learning Objectives =====
Zeile 22: Zeile 18:
  
 Each of these commands can be executed **with or without filtering conditions**, affecting either specific rows or all rows within a table. Each of these commands can be executed **with or without filtering conditions**, affecting either specific rows or all rows within a table.
- 
-===== 1. INSERT Statement ===== 
-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); 
- 
-===== 2. UPDATE Statement ===== 
-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; 
- 
-==== 2.2 UPDATE without Filter ==== 
-If you omit the WHERE clause, the UPDATE command will modify every row in the table, which can lead to unintended changes, so it must be used with caution. 
- 
-**Syntax** 
-  UPDATE table_name  
-  SET column1 = value1; 
-   
-**Example** 
-  UPDATE employees  
-  SET salary = 70000; 
- 
-===== 3. DELETE Statement ===== 
-The DELETE command is used to remove records from a table. Like UPDATE, it can be run with or without a filter, making it vital to define the condition to avoid unintended data removal. 
- 
-==== 3.1 DELETE with Filter (WHERE Clause) ==== 
-Using a WHERE clause ensures that only specific rows matching the condition will be deleted. 
- 
-**Syntax:** 
-  DELETE FROM table_name  
-  WHERE condition; 
- 
-**Example** 
-  DELETE FROM employees  
-  WHERE employee_id = 1; 
-   
-   
-==== 3.2 DELETE without Filter ==== 
-Omitting the WHERE clause removes all data from the table, so it must be used cautiously. This operation doesn’t remove the table structure, just the rows. 
- 
-**Syntax:** 
-  DELETE FROM table_name; 
- 
-**Example:** 
-  DELETE FROM employees; 
  
 ===== Conclusion ===== ===== Conclusion =====
  • modul/m290/learningunits/lu07/theorie/01.1727690636.txt.gz
  • Zuletzt geändert: 2024/09/30 12:03
  • von vdemir