The document outlines a database lab exercise focused on creating a StudentManagement database and a Students table with specified columns. It includes SQL commands for inserting data, querying students in a specific class, updating a student's age, and deleting a record. The solutions provided demonstrate basic SQL operations for managing student records.
The document outlines a database lab exercise focused on creating a StudentManagement database and a Students table with specified columns. It includes SQL commands for inserting data, querying students in a specific class, updating a student's age, and deleting a record. The solutions provided demonstrate basic SQL operations for managing student records.
Create a database named StudentManagement. Inside this database, create a table Students with the following structure: Column Name Data Type Constraint
StudentID INT PRIMARY KEY
Name VARCHAR(50) NOT NULL
Age INT
Class VARCHAR(20)
AdmissionDate DATE
Solution: CREATE DATABASE StudentManagement;
USE StudentManagement;
CREATE TABLE Students (
StudentID INT PRIMARY KEY, Name VARCHAR(50) NOT NULL, Age INT, Class VARCHAR(20), AdmissionDate DATE ); Question 2: Insert Data
Insert the following data into the Students table:
Write a query to display all students who are in class 10th. Solution: SELECT * FROM Students WHERE Class = '10th'; Question 4: Update Data Update the age of Ali Ahmed to 16. Solution: UPDATE Students SET Age = 16 WHERE Name = 'Ali Ahmed';
Question 5: Delete a Record
Delete the record of the student with StudentID = 3. Solution: DELETE FROM Students WHERE StudentID = 3;
Lab-6# Experiment 6_ DDL Commands in SQL ## __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, underst