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.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
10 views3 pages
Database Lab
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.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3
Database Lab
Question 1: Create a Database and Table
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;