# Table Creation

Below is an example of table creation with different types of data structures and relationships

```sql
-- Table Creation where:
-- MajorCode is Pirmary Key

CREATE TABLE tblMajors (
    MajorCode INT NOT NULL,
    MajorDescription VARCHAR(50),
	PRIMARY KEY (MajorCode)
); 

-- Table Creation where:
-- Different Data Types are added

CREATE TABLE tblInstructors (
	InstructorNumber INT NOT NULL,
	InstructorFirst VARCHAR(50),
	InstructorLast VARCHAR(50),
	ContractStatus NUMERIC,
	PhoneNumber NUMERIC,
	PRIMARY KEY (InstructorNumber)
);

-- Table Creation where:
-- MajorCode is Forign Key

CREATE TABLE tblStudents (
	StudentNumber INT NOT NULL,
	StudentFrist VARCHAR(50),
	StudentLast VARCHAR(50),
	MajorCode INT FOREIGN KEY REFERENCES MajorCode(MajorCode),
	PRIMARY KEY (StudentNumber)
);

-- Creating Indexes

CREATE INDEX indexStudents
ON tlbStudents (StudentLast); 

CREATE INDEX indexGrades
ON tlbGrades (StudentNuber); 
```


---

# 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://docs.arkannis.net/database/general-sql/table-creation.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.
