Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

CSE 3001-DBMS LABORATORY-EXERCISE SHEET

Experiment No: 2

Experiment Title: Data manipulation Commands


Aim:

Create a new table for these functions:


1. COUNT function
2. SUM function
3. MAX function
4. MIN function
5. AVERAGE function
6. Using NOT NULL clause with SELECT command
Procedure:

A) Using aggregate functions (COUNT,SUM,AVERAGE,MIN,MAX) with


SELECT command
We create a new table for these functions:

1) COUNT function
Syntax:
SELECT COUNT(column) FROM table;

2) SUM function

Syntax:
SELECT SUM(column) FROM table;

3) MAX function

Syntax:
SELECT MAX(column) FROM table;

4) MIN function

Syntax:
SELECT MIN(column) FROM table;
Name of the Student: Soumili Bhattacharjee Date of Submission: 31/08/2022
Registration no: 21BAI10037 BTECH – CSE AI & ML
CSE 3001-DBMS LABORATORY-EXERCISE SHEET

5) AVERAGE function

Syntax:
SELECT AVG (column) FROM table;

B) Using NOT NULL clause with SELECT command

Syntax:
SELECT column_names FROM table_name WHERE column_name IS NOT NULL;

SQL Query:
CREATE TABLE student(
-> student_id int not null primary key,
-> name varchar (50),
-> marks int
-> );

INSERT INTO student values(1,"ram",50);


INSERT INTO student values(2,"tony",43);
INSERT INTO student values(3,"raja",49);
INSERT INTO student values(4,"steve",38);
INSERT INTO student values(5,"frank",40);

SELECT * FROM student;


SELECT COUNT(student_id) from student;
SELECT SUM(marks) from student;
SELECTMAX(marks) from student;
SELECT MIN(marks) from student;
SELECT AVG (marks) from student;
SELECT name FROM student WHERE student_id is not null;

Name of the Student: Soumili Bhattacharjee Date of Submission: 31/08/2022


Registration no: 21BAI10037 BTECH – CSE AI & ML
CSE 3001-DBMS LABORATORY-EXERCISE SHEET

Name of the Student: Soumili Bhattacharjee Date of Submission: 31/08/2022


Registration no: 21BAI10037 BTECH – CSE AI & ML
CSE 3001-DBMS LABORATORY-EXERCISE SHEET

Name of the Student: Soumili Bhattacharjee Date of Submission: 31/08/2022


Registration no: 21BAI10037 BTECH – CSE AI & ML
CSE 3001-DBMS LABORATORY-EXERCISE SHEET

Outcome: This experiment taught us how to make use of some of the data manipulation
command in MySQL.

Name of the Student: Soumili Bhattacharjee Date of Submission: 31/08/2022


Registration no: 21BAI10037 BTECH – CSE AI & ML

You might also like