Syntax of the CREATE Statement.
1. Creating a Database
CREATE DATABASE database_name;
CREATE DATABASE SchoolDB;
2. Creating a Table
CREATE TABLE table_name ( column1 datatype [constraints], column2 datatype [constraints], ... );
CREATE TABLE Students ( StudentID INT PRIMARY KEY, Name VARCHAR(100) NOT NULL, Age INT CHECK (Age >= 0), EnrollmentDate DATE );
| Column Name | Data Type | Constraints | Description |
|---|---|---|---|
| StudentID | INT | PRIMARY KEY | A unique identifier for each student. |
| Name | VARCHAR(100) | NOT NULL | The name of the student cannot be null. |
| Age | INT | CHECK (Age >= 0) | The age of the student must be a non-negative integer. |
| EnrollmentDate | DATE | The date when the student enrolled. |
3. Creating a View.
CREATE VIEW view_name AS SELECT column1, column2, ... FROM table_name WHERE condition;
CREATE VIEW StudentView AS SELECT Name, Age FROM Students WHERE Age >= 18;
4. Creating an Index.
CREATE INDEX index_name ON table_name (column1, column2, ...);
CREATE INDEX idx_student_name ON Students (Name);



%20Diagram.png)