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

Experiment 6

Business Analytics

Student Name : Abhilash Neog UID:-22MCA20355

Branch:- UIC Section/Group: 22MCA-3B

Semester:- 3rd Date of Performance:13/09/23

Subject Code:- 22CAH-703

---------------------------------------------------------------------------------------------

Aim of Experiment: Create Database, Create Table, Alter Table, Create View, Creating
Function, Creating Index and Dropping Objects.

Solution : - (1). Create Database :-

Create Database Business_Analytics;

(2). Creating Table :-


Create Table Student(
Student_id int, Student_name varchar(255),
Math_score int, Reading_score int, writing_score int );
(3). Alter
Table :-
ALTER TABLE Student
ADD Mobile_Number int ;
SELECT * FROM Student

(4). Create View :-

CREATE VIEW View1 AS


SELECT
Student_id,
Student_name
FROM
Student;
SELECT * FROM View1
(5). Creating Function :-

1) Count
SELECT COUNT(*) FROM Student
WHERE Math_score > 60;

2) Sum
SELECT SUM(Math_score) FROM Student;
3) AVG
SELECT AVG(Math_score) FROM Student;

4) MAX SELECT MAX(Math_score) FROM Student;

(6). Creating Index :- CREATE


INDEX idx ON Student(Student_id, Student_name);
(7). Dropping Objects :-

Dropping Column :- ALTER


TABLE Student
DROP COLUMN Mobile_Number; select *
from Student

You might also like