Experiment 6: DDL Commands in SQL: Lab Objective
Experiment 6: DDL Commands in SQL: Lab Objective
Lab Objective:
This lab aims to equip students with practical skills in using Data Definition Language
(DDL) commands in SQL. Students will learn to create, modify, and delete tables,
understanding how these operations are essential for managing database schemas.
Prerequisites:
● A foundational understanding of relational databases and SQL syntax.
● Familiarity with basic SQL operations such as selecting and inserting data.
● Access to an SQL environment (e.g., MySQL, PostgreSQL, SQL Server).
Lab Exercises:
1. Creating a Table
CREATE TABLE Students (
StudentID INT PRIMARY KEY NOT NULL,
FirstName VARCHAR(50) NOT NULL,
LastName VARCHAR(50) NOT NULL,
DateOfBirth DATE NOT NULL,
Email VARCHAR(100) UNIQUE NOT NULL
);
2. Altering a Table
● This ensures that the Email column cannot contain null values.
3. Dropping a Table
DROP TABLE Students;
Outcome:
Upon completing this lab, students will: