■ SQL Assignment
Instructions:
1 Write SQL statements for the following tasks.
2 Assume you are working with a Student Management System database.
3 Execute queries step by step and verify results.
Q1. CREATE TABLE
Create a table named STUDENTS with the following structure:
- StudentID (INT, Primary Key)
- Name (VARCHAR(50), NOT NULL)
- Age (INT, NOT NULL)
- Department (VARCHAR(30))
- Marks (INT)
Q2. INSERT Records
Insert at least 5 records into the STUDENTS table. Example:
INSERT INTO STUDENTS (StudentID, Name, Age, Department, Marks)
VALUES (1, 'Rahul Sharma', 20, 'Computer Science', 85);
Q3. SELECT with WHERE Clause
1. Retrieve details of students older than 21 years.
2. Retrieve names of students who scored more than 75 marks in 'Computer Science'.
3. Retrieve student records where Age between 18 and 22.
Q4. UPDATE with WHERE Clause
Update the marks of student 'Rahul Sharma' to 90.
Q5. DELETE with WHERE Clause
Delete the record of student whose StudentID = 3.
Q6. ALTER TABLE
1. Add a new column Email (VARCHAR(50)).
2. Modify the size of column Department to VARCHAR(50).
3. Drop the column Email.
Q7. DROP TABLE
Drop the table STUDENTS permanently.
■ Submission Requirement:
1 Write all SQL queries clearly.
2 Execute them in your SQL environment and attach screenshots of results.