0% found this document useful (0 votes)
16 views

Ba 6

Experiment 6 aimed to create a database and table, alter the table, create a view, and create functions and indexes while dropping objects. Key steps included: (1) creating a "Business_Analytics" database and "Student" table, (2) altering the "Student" table to add a column, (3) creating a view to select specific columns, (4) creating count, sum, avg, and max functions, (5) creating an index on two columns, and (6) dropping a column.

Uploaded by

deadm2996
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Ba 6

Experiment 6 aimed to create a database and table, alter the table, create a view, and create functions and indexes while dropping objects. Key steps included: (1) creating a "Business_Analytics" database and "Student" table, (2) altering the "Student" table to add a column, (3) creating a view to select specific columns, (4) creating count, sum, avg, and max functions, (5) creating an index on two columns, and (6) dropping a column.

Uploaded by

deadm2996
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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