0% found this document useful (0 votes)
14 views2 pages

DBMS SQL Practical With Output

The document provides practical examples of SQL commands for managing a Student table, including creating the table, inserting records, updating data, and using aggregate functions with GROUP BY. It demonstrates how to update a student's marks and retrieve data based on specific criteria using the LIKE operator. The output includes sample data and results for each SQL operation performed.

Uploaded by

sp978816
Copyright
© All Rights Reserved
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% found this document useful (0 votes)
14 views2 pages

DBMS SQL Practical With Output

The document provides practical examples of SQL commands for managing a Student table, including creating the table, inserting records, updating data, and using aggregate functions with GROUP BY. It demonstrates how to update a student's marks and retrieve data based on specific criteria using the LIKE operator. The output includes sample data and results for each SQL operation performed.

Uploaded by

sp978816
Copyright
© All Rights Reserved
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

Database Management System - SQL Practical

(With Output)

1. Create & Insert Student Table


CREATE TABLE Student (
RollNo INT PRIMARY KEY,
Name VARCHAR(50),
Department VARCHAR(30),
Age INT,
Marks INT
);

-- Insert Records

RollNo Name Department Age Marks


1 Rahul CSE 20 85
2 Anita ECE 21 90
3 Kiran CSE 19 75
4 Sneha ME 22 88
5 Arjun ECE 20 70

2. UPDATE Example
UPDATE Student
SET Marks = 95
WHERE RollNo = 1;

RollNo Name Department Age Marks


1 Rahul CSE 20 95

3. GROUP BY with Aggregate Functions


SELECT Department,
MIN(Marks),
MAX(Marks),
SUM(Marks),
COUNT(*),
AVG(Marks)
FROM Student
GROUP BY Department;

Department Minimum Maximum Total Count Average


CSE 75 95 170 2 85
ECE 90 90 90 1 90
ME 88 88 88 1 88
4. LIKE Operator
SELECT * FROM Student WHERE Name LIKE 'A%';

RollNo Name Department Age Marks


2 Anita ECE 21 90
5 Arjun ECE 20 70

You might also like