2lab2 DB
2lab2 DB
LAB-2
Objectives
- Understand CREATE command in SQL.
- Understand DROP Command in SQL.
- Study different data types in SQL.
- Know how to build a database and tables based on a given scenario.
Create a database:
Drop a database:
Drop a table:
Create a table:
);
Data Types
SQL offers a variety of data types to store different kinds of data. Here
are some common SQL data types:
Steps:
Create Entities:
Department
Course
Student
Teacher
Enrollment (for the Student-Course relationship)
Define Attributes:
Department: DepartmentID (PK), DepartmentName
Course: CourseID (PK), CourseName, Credits, TeacherID , DepartmentID
Student: StudentID (PK), Name, Address, Score, DepartmentID
Teacher: TeacherID (PK), Name, Address, Salary, DepartmentID
Enrollment: EnrollmentID (PK), EnrollmentDate, Grade, StudentID , CourseID