> For the complete documentation index, see [llms.txt](https://vikram-bajaj.gitbook.io/cs-gy-6083-principles-of-database-systems/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vikram-bajaj.gitbook.io/cs-gy-6083-principles-of-database-systems/main-1/sql/dml-commands/database-modification.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` 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>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
