Data Manipulation Language (INSERT, UPDATE, DELETE)
INSERT The INSERT command is used to add new rows of data to a table. It is similar to the 'Add Row' option in most spreadsheet applications. Syntax: sq...
INSERT The INSERT command is used to add new rows of data to a table. It is similar to the 'Add Row' option in most spreadsheet applications. Syntax: sq...
INSERT
The INSERT command is used to add new rows of data to a table. It is similar to the 'Add Row' option in most spreadsheet applications.
Syntax:
sql
INSERT INTO table_name (column_1, column_2, ...)
VALUES (value_1, value_2, ...)
Example:
sql
INSERT INTO students (name, age)
VALUES ("John Doe", 25)
This will add a new row to the 'students' table with the name "John Doe" and age 25.
UPDATE
The UPDATE command is used to modify existing rows of data in a table. It is similar to the 'Edit' option in most spreadsheet applications.
Syntax:
sql
UPDATE table_name SET column_name = new_value
WHERE condition
Example:
sql
UPDATE orders SET shipped_on = '2023-04-01'
WHERE order_id = 123
This will update the 'shipped_on' column for all rows in the 'orders' table where the 'order_id' is 123 and set it to '2023-04-01'.
DELETE
The DELETE command is used to remove existing rows of data from a table. It is similar to the 'Delete' option in most spreadsheet applications.
Syntax:
sql
DELETE FROM table_name
WHERE condition
Example:
sql
DELETE FROM products WHERE category = 'electronics'
This will delete all rows from the 'products' table where the 'category' column is 'electronics'