# Database Modification

This section deals with the insertion, updation and deletion of records from the database.

## Insertion

Insert values into a relation using:

```
insert into r values (V1, V2, ..., Vn)
```

We can also insert the results of a select query into a relation (if there are no errors in the result of the query)

```
insert into r select attributes from s where P
```

## Updation

This is used to update existing records.

```
update r set attribute=new_value where P
```

**case** statements can be used for conditional updates, as shown in the example below:

```
update instructor
 set salary = case
               when salary <= 100000 then salary * 1.05
               else salary * 1.03
              end
```

## Deletion

To delete all records, use:

```
delete from r
```

To delete specific records, use:

```
delete from r where P
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://vikram-bajaj.gitbook.io/cs-gy-6083-principles-of-database-systems/main-1/sql/dml-commands/database-modification.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
