# Creating a Table

```
create table r (A1 D1, A2 D2, ..., An Dn, IC1, IC2, ..., ICk)
```

* r is the name of the relation/table
* A1, A2, ..., An are attributes
* D1, D2, ..., Dn are the data types of values in the domains of the corresponding attributes
* IC1, IC2, ..., ICk are integrity constraints

Ex. the following creates a table for the instructor relation with primary and foreign key constraints

```
create table instructor (ID char(5), name varchar(20) not null, dept_name varchar(20), salary numeric(8, 2), 
                         primary key (ID), foreign key (dept_name) references department)
```

## Inserting Values

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


---

# 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/ddl-commands/creating-a-table.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.
